fix: filebrowser scroll+lang hover+black-flash+shell one-line
- filebrowser: select() only scrollIntoView on keyboard, not hover - lang-switch: .lang-switch:hover → invert rule (header excluded before) - black-flash: color-scheme light; dark script sets colorScheme - shell: flex-wrap nowrap; keepEnd() scrolls on input Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -10,10 +10,15 @@
|
||||
.prompt {
|
||||
font-family: var(--font-family-mono);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
/* stay on ONE line: when the command gets too wide, clip the left (older)
|
||||
part terminal-style and keep the caret/right end visible (shell.js scrolls
|
||||
it to the end). previously flex-wrap:wrap dropped to a 2nd line and bugged. */
|
||||
flex-wrap: nowrap;
|
||||
align-items: flex-start;
|
||||
gap: 0;
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.prompt__user { font-weight: 700; }
|
||||
.prompt__path { color: var(--color-text-muted); }
|
||||
@@ -299,9 +304,11 @@ body {
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
/* dotted content + footer links: unchanged at rest, invert to black on hover */
|
||||
/* dotted content + footer links: unchanged at rest, invert to black on hover.
|
||||
include the header language switch so en/de behave like every other link. */
|
||||
main a:hover,
|
||||
footer a:hover {
|
||||
footer a:hover,
|
||||
.lang-switch:hover {
|
||||
background: var(--color-text-primary);
|
||||
color: var(--color-bg-primary);
|
||||
border-bottom-color: transparent;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
if (img.complete) img.style.opacity = "1"; // already cached → no fade
|
||||
}
|
||||
|
||||
function select(i, silent) {
|
||||
function select(i, silent, scroll) {
|
||||
if (!rows.length) return;
|
||||
if (i < 0) i = 0;
|
||||
if (i >= rows.length) i = rows.length - 1;
|
||||
@@ -39,7 +39,9 @@
|
||||
for (var r = 0; r < rows.length; r++) rows[r].classList.remove("is-selected");
|
||||
var a = rows[i];
|
||||
a.classList.add("is-selected");
|
||||
if (a.scrollIntoView) a.scrollIntoView({ block: "nearest" });
|
||||
// only scroll for keyboard nav — scrolling on hover nudges edge rows out from
|
||||
// under the cursor, so the top/bottom row "sometimes" can't be clicked.
|
||||
if (scroll && a.scrollIntoView) a.scrollIntoView({ block: "nearest" });
|
||||
|
||||
var src = a.getAttribute("data-img");
|
||||
var tkey = a.getAttribute("data-text");
|
||||
@@ -100,8 +102,8 @@
|
||||
var t = e.target;
|
||||
if (t && (t.isContentEditable || /^(input|textarea|select)$/i.test(t.tagName))) return;
|
||||
if (!rows.length) return;
|
||||
if (e.key === "ArrowDown") { e.preventDefault(); select(cur + 1); }
|
||||
else if (e.key === "ArrowUp") { e.preventDefault(); select(cur - 1); }
|
||||
if (e.key === "ArrowDown") { e.preventDefault(); select(cur + 1, false, true); }
|
||||
else if (e.key === "ArrowUp") { e.preventDefault(); select(cur - 1, false, true); }
|
||||
else if (e.key === "Enter") {
|
||||
var href = rows[cur] && rows[cur].getAttribute("href");
|
||||
if (href) { if (window.pjax) window.pjax(href); else window.location.href = href; }
|
||||
|
||||
+7
-1
@@ -8,8 +8,13 @@
|
||||
var input = document.querySelector(".prompt__input");
|
||||
var out = document.querySelector(".prompt__out");
|
||||
var menu = document.querySelector(".menu");
|
||||
var promptEl = document.querySelector(".prompt");
|
||||
if (!bar || !input) return;
|
||||
|
||||
// keep the caret/right end in view: when the line overflows, scroll it fully
|
||||
// right so the left (older) part clips off terminal-style instead of wrapping.
|
||||
function keepEnd() { if (promptEl) promptEl.scrollLeft = promptEl.scrollWidth; }
|
||||
|
||||
var home = bar.getAttribute("data-home") || "/";
|
||||
|
||||
// command → url: the always-open menu, plus any context routes (e.g. the
|
||||
@@ -307,7 +312,7 @@
|
||||
caretToEnd(); say("");
|
||||
}
|
||||
});
|
||||
input.addEventListener("input", function () { say(""); });
|
||||
input.addEventListener("input", function () { say(""); keepEnd(); });
|
||||
|
||||
function caretToEnd() {
|
||||
var r = document.createRange();
|
||||
@@ -316,6 +321,7 @@
|
||||
var s = window.getSelection();
|
||||
s.removeAllRanges();
|
||||
s.addRange(r);
|
||||
keepEnd();
|
||||
}
|
||||
|
||||
// start typing anywhere → the keystroke goes straight into the command line
|
||||
|
||||
Reference in New Issue
Block a user