Rationale
C.0.7e (PR #782) shipped cursor-based input editing with a field rename (input_cursor → input_len + input_cursor_pos). Local /gate review flagged 4 P2 polish items deferred from the PR.
Items
1. Stale input_cursor references in prose comments
After the rename, 3 prose comments still reference the old field name input_cursor:
frontier-cli/boxen_repl.c:620 — comment describing history nav (in the "update input_buf / input_cursor accordingly" prose)
frontier-cli/boxen_repl.c:997 — comment in popup-close fallthrough handler ("input_cursor == 0 check")
tests/boxen_repl_tests.c — several stale references in docblock prose (lines 1756, 1761, 1765, 1855, 1880, 1887 in current file)
Replace each with the appropriate name (input_len for length use, input_cursor_pos for caret position).
2. History-nav-during-caret-movement design note
When user is in the middle of typing, presses LEFT to position caret in the middle of input, then presses UP to nav history — the loaded history entry replaces the WHOLE input_buf and resets cursor to end-of-buffer. Caret position is lost.
This is consistent with linenoise behavior but undocumented. Add a code comment near the UP/DOWN history-nav handlers in boxen_repl.c documenting "history nav replaces both input_len and input_cursor_pos; caret position is not preserved across nav".
3. Fn+Delete discoverability — second binding via Ctrl-D
C.0.7e's forward-Delete binding is BOXEN_KEY_DELETE only. On Mac laptops this requires Fn+Delete which is not discoverable. Linenoise binds Ctrl-D as forward-delete (alongside the named Delete key). Add Ctrl-D as a second binding for forward-delete in boxen_repl.c::on_input.
4. No horizontal scroll for off-screen text after LEFT-navigation
When input_len > text_avail (input wider than rendered width), pressing LEFT to navigate past the visible region currently does nothing visible (caret moves off-screen). Pre-existing limitation but now more visible with cursor editing.
Implement horizontal scrolling in draw_input_bar: when input_cursor_pos < scroll_offset, decrement scroll_offset; when input_cursor_pos > scroll_offset + text_avail, increment. Needs new state field input_scroll_offset.
Exit Criteria
Context
Rationale
C.0.7e (PR #782) shipped cursor-based input editing with a field rename (
input_cursor→input_len+input_cursor_pos). Local /gate review flagged 4 P2 polish items deferred from the PR.Items
1. Stale
input_cursorreferences in prose commentsAfter the rename, 3 prose comments still reference the old field name
input_cursor:frontier-cli/boxen_repl.c:620— comment describing history nav (in the "update input_buf / input_cursor accordingly" prose)frontier-cli/boxen_repl.c:997— comment in popup-close fallthrough handler ("input_cursor == 0 check")tests/boxen_repl_tests.c— several stale references in docblock prose (lines 1756, 1761, 1765, 1855, 1880, 1887 in current file)Replace each with the appropriate name (
input_lenfor length use,input_cursor_posfor caret position).2. History-nav-during-caret-movement design note
When user is in the middle of typing, presses LEFT to position caret in the middle of input, then presses UP to nav history — the loaded history entry replaces the WHOLE input_buf and resets cursor to end-of-buffer. Caret position is lost.
This is consistent with linenoise behavior but undocumented. Add a code comment near the UP/DOWN history-nav handlers in
boxen_repl.cdocumenting "history nav replaces both input_len and input_cursor_pos; caret position is not preserved across nav".3. Fn+Delete discoverability — second binding via Ctrl-D
C.0.7e's forward-Delete binding is
BOXEN_KEY_DELETEonly. On Mac laptops this requiresFn+Deletewhich is not discoverable. Linenoise binds Ctrl-D as forward-delete (alongside the named Delete key). Add Ctrl-D as a second binding for forward-delete in boxen_repl.c::on_input.4. No horizontal scroll for off-screen text after LEFT-navigation
When
input_len > text_avail(input wider than rendered width), pressing LEFT to navigate past the visible region currently does nothing visible (caret moves off-screen). Pre-existing limitation but now more visible with cursor editing.Implement horizontal scrolling in
draw_input_bar: wheninput_cursor_pos < scroll_offset, decrementscroll_offset; wheninput_cursor_pos > scroll_offset + text_avail, increment. Needs new state fieldinput_scroll_offset.Exit Criteria
Context