mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 07:29:42 +02:00
fix(mobile): keep the one-shot Ctrl armed through terminal-generated reports
Review of #268 turned up two defects, both verified against a real shell session on an isolated instance. 1. A tap spent the modifier. The onData hook consumed every chunk while armed, but not every chunk is a keystroke: a shell session keeps the narrow scrollback strip, so mouse DECSETs reach the browser, and with vim/htop running a tap arrives as `\x1b[<0;31;23M`. Measured in the real app: armed, one tap, disarmed, and the Ctrl button read as dead. The hook now skips mouse and focus reports via a new `CodemanTerminalInput.isTerminalFocusOrMouseReport()`; they still reach the PTY, they just no longer stand in for the next key. Focus reports are covered for the same reason even though FOCUS_ESCAPE_FILTER in session.ts strips DECSET 1004 today, since the bar refocuses the terminal after every key and would spend the modifier on its own `\x1b[I` the moment that filter changed. 2. The armed style did not land on the four light skins. The competing rule is (0,3,1), not (0,2,1) as the comments claimed: `:is()` takes the specificity of its most specific argument and that list holds `.btn-toolbar.btn-shell`, so it outranked the (0,3,0) armed rules in both stylesheets. Measured across all seven skins at 390px, armed and resting backgrounds were byte-identical on paper-gray, solarized-light, catppuccin-latte and rose-pine-dawn. The light-skin rule now excludes the state as `.accessory-btn:not(.armed)`, which fixes phone and tablet at once; adding another class to the armed rules would only have moved the tie. Tests: 20 more cases in test/mobile-shell-keyboard.test.ts (the report classifier, the gate's effect on the modifier, and a static guard on the light-skin selector, since the existing E2E background assertion passes on a light skin and the browser suite runs the dark default), plus a browser regression that taps the terminal with mouse reporting on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1163,8 +1163,9 @@ html.mobile-init .file-browser-panel {
|
||||
}
|
||||
|
||||
/* Armed one-shot Ctrl (shell bar, issue #262). Phone palette is hardcoded in
|
||||
this block, so the state needs its own entry here; three classes to outrank
|
||||
the light-skin .accessory-btn rule at the bottom of this file. */
|
||||
this block, so the state needs its own entry here. Three classes beat the
|
||||
plain .accessory-btn rules; the light-skin rule at the bottom of this file
|
||||
is higher still at (0,3,1) and is excluded by hand there, not outranked. */
|
||||
.accessory-btn.accessory-btn-ctrl.armed {
|
||||
background: #2563eb;
|
||||
border-color: rgba(59, 130, 246, 0.9);
|
||||
@@ -2918,7 +2919,13 @@ html:is([data-skin="paper-gray"], [data-skin="solarized-light"], [data-skin="cat
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
html:is([data-skin="paper-gray"], [data-skin="solarized-light"], [data-skin="catppuccin-latte"], [data-skin="rose-pine-dawn"]) :is(.btn-voice-mobile, .btn-settings-mobile, .btn-toolbar.btn-shell, .toolbar .btn-case-add, .accessory-btn) {
|
||||
/* `.accessory-btn:not(.armed)` on purpose: this selector is (0,3,1) — `:is()`
|
||||
takes the specificity of its most specific argument, and `.btn-toolbar
|
||||
.btn-shell` is two classes — so it OUTRANKS the (0,3,0) armed-Ctrl rules in
|
||||
both stylesheets and repainted the armed modifier back to a resting button on
|
||||
all four light skins. Excluding the state here fixes phone and tablet at once;
|
||||
adding a class to the armed rules would only have moved the tie. */
|
||||
html:is([data-skin="paper-gray"], [data-skin="solarized-light"], [data-skin="catppuccin-latte"], [data-skin="rose-pine-dawn"]) :is(.btn-voice-mobile, .btn-settings-mobile, .btn-toolbar.btn-shell, .toolbar .btn-case-add, .accessory-btn:not(.armed)) {
|
||||
background: var(--control-bg);
|
||||
border-color: var(--control-border);
|
||||
color: var(--text-dim);
|
||||
|
||||
Reference in New Issue
Block a user