diff --git a/docs/wiki/Input-And-Voice.md b/docs/wiki/Input-And-Voice.md index 99e18a0d..54b29cfa 100644 --- a/docs/wiki/Input-And-Voice.md +++ b/docs/wiki/Input-And-Voice.md @@ -69,17 +69,19 @@ sequences, so word jumps and history keys keep working. On a phone, **Input Field: Send on Enter** (beside CJK input) turns that field into a chat box: typed text stays in it until Enter, so you can scroll the terminal back to a question and edit -your answer before sending. Shift+Enter adds a line, Esc clears the field, and autocorrect is on. -Enter always goes out as its own write, a moment after the text, to the session the answer was -typed for: a single character is typed, so CLI menus that take a digit still work, and anything -longer goes like the prompt composer's Send, as one paste. The one exception is a lone digit while -a permission or question dialog is waiting: the digit answers the dialog by itself, so no Enter -follows it, which would otherwise confirm whatever the CLI shows next. The toolbar's Enter button -sends the field too. With the keyboard bar's one-shot Ctrl armed, the next key you type goes out -as a control key (Ctrl, then `c` is Ctrl+C) instead of being held. With a hardware keyboard, Ctrl -shortcuts (undo, select all, copy) act on the field while it holds a draft and reach the CLI only -when it is empty. With the keyboard down the field stays one line tall. A draft stays with its -session: switching tabs and coming back brings it back. +your answer before sending. With a hardware keyboard, Shift+Enter adds a line (a phone's on-screen +keyboard has no Shift+Enter, and the extended bar's newline key goes to the CLI, not the field), +Esc clears the field, and autocorrect is on. Enter always goes out as its own write, a moment +after the text, to the session the answer was typed for: a single character is typed, so CLI menus +that take a digit still work, and anything longer goes like the prompt composer's Send, as one +paste. The one exception is a lone digit while a permission or question dialog is waiting: the +digit answers the dialog by itself, so no Enter follows it, which would otherwise confirm whatever +the CLI shows next. The toolbar's Enter button sends the field too. With the keyboard bar's +one-shot Ctrl armed, the next key you type goes out as a control key (Ctrl, then `c` is Ctrl+C) +instead of being held. With a hardware keyboard, Ctrl shortcuts (undo, select all, copy) act on +the field while it holds a draft and reach the CLI only when it is empty. With the keyboard down +the field stays one line tall. A draft stays with its session: switching tabs and coming back +brings it back. ## Voice dictation diff --git a/src/web/public/input-cjk.js b/src/web/public/input-cjk.js index fd4c0c31..279d230f 100644 --- a/src/web/public/input-cjk.js +++ b/src/web/public/input-cjk.js @@ -251,6 +251,15 @@ const CjkInput = (() => { _textarea.style.height = ''; return; } + // Only a touch device grows the field: there it is position: fixed above the + // keyboard. On a desktop it sits in the flex column under the terminal, so + // every line it gained would shrink the terminal box, refit and resize the + // session's PTY (a CLI repaint each time). It stays one line there and + // scrolls inside instead. + if (!document.body?.classList?.contains('touch-device')) { + _textarea.style.height = ''; + return; + } const before = _textarea.style.height; _textarea.style.height = 'auto'; // border-box: scrollHeight leaves the borders out, offsetHeight - clientHeight adds them back. @@ -689,9 +698,13 @@ const CjkInput = (() => { _textarea.setAttribute('autocorrect', v); _textarea.setAttribute('autocapitalize', _hold ? 'sentences' : 'off'); _textarea.setAttribute('spellcheck', _hold ? 'true' : 'false'); - _textarea.placeholder = _hold + // i18n.js skips