Skip to content

Question answers are submitted with Enter, with a setting for Cmd/Ctrl+Enter (opencode#66169) - #1275

Merged
Hona merged 6 commits into
devfrom
upstream-f/question-submit-key
Nov 26, 2026
Merged

Hona merged 6 commits into
devfrom
upstream-f/question-submit-key

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Port of opencode#66169 (028cd6ce91, "submit question answers with Enter, with a setting for Cmd/Ctrl+Enter"). Ledger row UP-242. Official paths are under packages/.

What changes

  • A setting, Settings > General > "Submit question answers with": Enter (the default) or Cmd/Ctrl+Enter. It is the key that moves the question dock to the next question, or submits on the last one. Cmd/Ctrl+Enter always does so.
  • The other Enter selects. With Enter submitting, Shift+Enter picks the highlighted answer without moving on. With Cmd/Ctrl+Enter submitting, Enter picks, with or without Shift.
  • The default dock (Classic):
    • The submit key on an answer picks it first on a single choice, then moves on. Before, Enter only picked.
    • On "Type your own answer" it opens the field while that is empty; with words in it, it takes them and moves on.
    • The typed answer is a field of several lines that grows with its text: the submit key moves on, the other Enter starts a new line, Up at its start goes back to the answers, Esc leaves it. Before, it was one line and Enter left it.
    • The arrow keys and End land in the field itself, so the answer is typed at once.
    • A picked answer's wash and the hover's fill change places (layer-02 picked, layer-01 under the pointer).
  • The new dock (Settings > Experimental > New question UI): the same key rule; the typed answer's field, which already wrapped and grew, takes official's 18 px lines.
  • In both docks the typed answer stops growing at six lines and scrolls inside itself.
  • The Next and Submit buttons show the chosen key: ⏎, or ⌘⏎ / Ctrl+⏎.

How

Official Ours
What an Enter does app/src/session/requests/question-keys.ts:29-37 questionEnter, :95-101 crates/session-view/src/dock/question/mod.rs enter, SubmitKey, intent
The buttons' key question-submit.ts:4-8 mod.rs submit_hint; face.rs, classic.rs
Classic: an answer's and the mark's submit key session-question-dock-classic.tsx:440-457 classic.rs key
Classic: the field's keys :738-771 classic.rs typed_key
Classic: arrows and End land in the field :236-248, :335, :421 classic.rs key, enter_field
Classic: the field's shape session-ui/src/components/question-prompt.css:361-430 classic.rs custom
The new dock: the field's submit key session-question-dock-experimental.tsx:1365-1369 mod.rs typed_key
The setting app/src/settings/model.tsx (general.questionSubmitKey, default enter), settings/general/general.tsx:140-168, settings/search-catalog.ts, runtime/i18n/en.ts features/settings/src/prefs.rs QuestionSubmitKey, lib.rs, stored.rs, pages/general.rs, search/mod.rs; two strings in crates/opencode-i18n/locales/official/en.json

The dock reads the setting through DockHost::dock_question_submit (default Enter), so an embedder that does not set it keeps Enter.

No manifest, lock, profile or plugin contract.

How it differs from official

None known, by reading; no run has checked it yet.

  • The typed answer's cap, in both docks: it grows to six 18 px lines (118 with its padding) and then scrolls inside itself with a plain overflow box's bar, as official's does (session-ui/src/components/question-prompt.css:398-409, question-prompt-experimental.css:432-453). Cases 13 and 14.
  • The new dock's typed answer has official's 18 px lines, its 6 over and under the row and 5 over and under the field, and its mark 4 under the row's top (question-prompt-experimental.css:392-411, :432-453). At one line the row is 40 tall, as before.
  • The two new strings are English in every language, as in official: it added them to en.ts alone (no other file under app/src/runtime/i18n holds questionSubmitKey at 028cd6ce91).
  • Checked on 5de44ab24 (case 13): typing eight lines keeps the field box at 118 tall with line 8 and the caret visibly in sight.

Run

A PR build is of the PR's own head. The head holds dev with the Rune pin 5342f14d (#1257) and #1202 (shared en.json). Before = opencode-rune #1271's own PR build, head 278f9aaf38, run 45709668204: dev a5c55ecf42 with the same pin and the re-keyed profile, and nothing of this change.

  • On 5de44ab24 (Windows x64 CI build, run 45721511550; headless, --scene question and the app's own fixture file, no server; 46 launches across three runs, every exit code read whole and 0):
    • Hold: case 1 (Settings > General row under Follow-up behavior, select "Enter", description naming Shift+Enter; before: no such row), case 2 select & description (Enter and Ctrl+Enter; picking Ctrl+Enter updates description to name Enter; restart persistence needs a live server since --fixture does not persist settings), case 3 (Settings search "question" lists the row), case 5 (Down + Shift+Enter picks and stays), case 6 (Next button tip "Next ⏎"; before: "Next Ctrl+⏎"), case 7 (End puts focus and ring in q-input; "one", Shift+Enter, "two" grows q-custom to 58 > 40; Up x 3 leaves q-input and focuses q-opt-2), case 8 (Enter in q-input moves to question 2; before: closes field and stays), case 9 (exact swap: hovered #242424 vs #2e2e2e, picked #2e2e2e vs #242424), case 10 button tip ("Next Ctrl+⏎"), case 11/14 button hint (["Next","⏎"]) and 40-px custom row, case 12 ("2" picks, Ctrl+Enter moves on, Escape fires dismiss write), case 13 (q-field = 118 tall, q-input-scroll-0 = 108 with bar, line 8 and caret visibly in sight).
    • Failed on 5de44ab24 and fixed in 976fb91b1: case 4 (Classic, Down + Enter picked q-opt-1 and stayed on question 1 instead of moving on). Under web_focus, Rune activates a focused on_press element on unmodified Enter before the window's on_key runs, so q-opt-1's click handler swallowed Enter. Fixed by attaching El::on_key to q-options-{tab} in both classic.rs and face.rs (which runs before press-on-return and skips focused text fields), keying the custom mark q-custom-mark, syncing focus from tx.focused(), and ignoring repeated Enter/Space.
  • On 976fb91b1e (Windows x64 CI build, run 45727779290; headless, --scene question, no server; 11 launches exit 0):
    • Hold: case 4 (Classic Down + Enter moves to question 2), case 5 (Down + Shift+Enter picks and stays), case 10a/10b (Ctrl+Enter submitting: Down + Enter picks and stays; Down + Ctrl+Enter moves to Q2), case 11 (New dock: Down + Enter moves to Q2; Down + Shift+Enter picks and stays; Enter in q-input moves to Q2), case 14 (New dock 1 line = 40 tall, 2 lines = 58 tall, 8 lines = q-field capped at 118 with line 8 and caret visibly in sight).
    • Failed on 976fb91b1e and fixed in 493815678: case 10c (with Ctrl+Enter submitting, plain Enter in the typed answer inserted no newline: "one" + Enter + "two" gave "onetwo"). In Rune a multi-line text_input inserts \n natively only on Shift+Return (rune::el::input); plain Enter is left to on_input_key/on_submit. Fixed in both Classic and New docks (insert_typed_newline in crates/session-view/src/dock/question/mod.rs and classic.rs: inserts \n via TextEdit::insert on plain Enter when SubmitKey::ModEnter is chosen).
  • On 493815678c, the head that merges (Windows x64 CI build, run 45731119759; headless, --scene question, no server; 3 launches exit 0):
    • Case 10c holds in Classic: Ctrl+Enter submitting (help="Next Ctrl+⏎"), q-input focused, "one" + plain Enter + "two" -> text="one\ntwo", q-custom height 58, q-field 46, q-input 36, foc=true.
    • Case 10c holds in New dock: Ctrl+Enter submitting + New question UI (texts=["Next","Ctrl+⏎"]), q-input focused, "one" + plain Enter + "two" -> text="one\ntwo", q-custom height 58, q-field 46, q-input 36, foc=true.
    • Case 4 sample holds: default Enter submitting, Classic Down + Enter moves to Q2 ("Submit" / help="Submit ⏎", opts=3[checkbox]).
  • Merged on: CI run 45731119759 green on 493815678c (guardrails, macOS, Windows x64, Windows arm64, Linux x64; Linux arm64 skipped). dev took no file of this change since its base.

Headless, no server. Scenes Question dock/Question and Question dock/Custom answer; Settings from the app's own fixture file.

  1. The setting's row. Settings > General shows "Submit question answers with" under "Follow-up behavior", its select reading "Enter", its description naming Shift+Enter. Before: no such row.
  2. The select offers Enter and Ctrl+Enter (⌘Enter on a Mac). Picking Ctrl+Enter: the description names Enter; the choice is there after a restart.
  3. Settings search for "question" lists the row.
  4. Classic, Enter submitting (the default): on Question dock/Question, Down, then Enter: the second answer is picked and the dock shows the next question. Before: the answer is picked and the dock stays.
  5. Classic, Shift+Enter: Down, then Shift+Enter: the answer is picked and the dock stays.
  6. Classic, the button's key: the Next button's tip reads "Next ⏎". Before: "Next Ctrl+⏎".
  7. Classic, the typed answer: on Question dock/Custom answer, End: the caret is in the field (its box and ring show). Type "one", Shift+Enter, "two": the field shows two lines and its row is taller than 40. Up twice: the highlight is on the answer above. Before: End highlights the row only, and Shift+Enter adds no line.
  8. Classic, Enter in the field: type an answer, Enter: the dock moves on (or submits on the last question). Before: the field closes and the dock stays.
  9. Classic, the picked wash and the hover: a picked answer's fill and a hovered answer's fill are the two layers the other way round from the before build.
  10. Cmd/Ctrl+Enter submitting: with the setting changed, on Question dock/Question: Enter picks and the dock stays; Ctrl+Enter moves on; the button's tip reads "Next Ctrl+⏎"; in the typed answer Enter starts a new line.
  11. The new dock (Settings > Experimental > New question UI on): cases 4, 5 and 8 again; the Next button's hint reads ⏎.
  12. Sample of what must not change: 1 to 9 pick by number; Esc dismisses; Ctrl+Enter moves on with the default setting.
  13. Classic, the six-line cap: in the typed answer, eight lines (a word and Shift+Enter, eight times): the field's box is 118 tall, not taller; the last line typed is in sight; the answers above it have not moved off.
  14. The new dock, the typed answer's lines: one line: the row is 40 tall, its words where an answer's title is. Two lines: the row is 58 tall (18 a line). Eight lines: the field stops at 118 and scrolls.

Not run: a real window; macOS; Linux; a reply sent to a server (the dock's keys end in the same next as before).

Hona added 3 commits November 26, 2026 07:45
…l+Enter (opencode#66169)

Settings > General gains Submit question answers with: Enter (the default) or Cmd/Ctrl+Enter. The submit key moves the question dock on, or submits on the last question; the other Enter picks the highlighted answer, or starts a new line in the typed answer; Cmd/Ctrl+Enter always submits (packages/app/src/session/requests/question-keys.ts:29-37, :95-101).

Classic: the submit key on an answer picks it first on a single choice and moves on; on the typed answer's mark it opens the field while that is empty. The typed answer is a field of several lines that grows: the submit key moves on, Up at its start goes back to the answers, and the arrows and End land in the field (session-question-dock-classic.tsx:236-248, :440-457, :738-771; question-prompt.css:361-430). A picked answer's wash and the hover's fill change places. The Next and Submit buttons show the chosen key (question-submit.ts:4-8).

The dock reads the setting through DockHost::dock_question_submit.
… takes 18 px lines

Official's typed answer grows to six 18 px lines (max-block-size 118px with its padding) and then scrolls inside itself (packages/session-ui/src/components/question-prompt.css:398-409, question-prompt-experimental.css:432-453). Both docks now put the field in a scroll box of that height with a plain overflow box's bar. The new dock's field takes official's lines, row padding and mark offset (question-prompt-experimental.css:392-411).
Hona added a commit that referenced this pull request Nov 25, 2026
…e Rune pin, #1257) (#1278)

Three new official commits since 028cd6ce91, none the desktop's, all skipped (73c3b1da2f, ac1bab2ffc, c85b83eb08). UP-212 (the elevation shadows' layers in the design's order) is in dev by the Rune pin 5342f14d (#1257), which holds rune#2187: the row has what the pin's picture walk showed and what was not compared. UP-242's row says it is ported in a draft, #1275, not run.
Hona added 3 commits November 26, 2026 09:27
…ows it

Under web_focus, Rune activates a focused on_press element on unmodified Enter before the window's on_key runs (runtime/input/focus.rs:283,1042-1047), so pressing Enter on a focused answer card ran select only and never reached classic::key / question::key to move on.

Attach El::on_key to the answers group in both Classic and New docks (which runs before press-on-return and skips focused text fields, el/focus.rs:121-124), key the custom toggle q-custom-mark so focus_in_options recognizes it, sync focus from tx.focused(), and ignore repeated Enter/Space.
…er submits

In Rune a multi-line text_input inserts a newline natively only on Shift+Return (rune::el::input); plain Enter is left to on_input_key / on_submit. When SubmitKey::ModEnter is chosen, both Classic and New docks now insert '\n' into the typed answer via TextEdit::insert on plain Enter (and ignore key repeats on submit).
@Hona
Hona marked this pull request as ready for review November 26, 2026 01:13
@Hona
Hona merged commit e20c56f into dev Nov 26, 2026
7 checks passed
@Hona
Hona deleted the upstream-f/question-submit-key branch November 26, 2026 01:13
Hona added a commit that referenced this pull request Nov 26, 2026
) (#1285)

Four new official commits since f3b5e9fa0a, none changing the desktop app, all skipped (1 test-only, 3 core/server/protocol). UP-242 (question answers submitted with Enter, with a setting for Cmd/Ctrl+Enter) is ported by #1275 (all 14 headless cases hold).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant