diff options
Diffstat (limited to '')
| -rw-r--r-- | CHANGELOG.md | 9 | ||||
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | docs/KNOWN-ISSUES.md | 15 | ||||
| -rwxr-xr-x | scripts/ux-check.sh | 24 | ||||
| -rw-r--r-- | src/line.rs | 14 |
6 files changed, 55 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d33608d..99b92db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
| @@ -7,6 +7,15 @@ break the interface, **PATCH** for bug fixes. | |||
| 7 | file, and the tool schemas the model sees. Anything a script or a resumed session | 7 | file, and the tool schemas the model sees. Anything a script or a resumed session |
| 8 | could depend on counts as API. | 8 | could depend on counts as API. |
| 9 | 9 | ||
| 10 | ## 0.6.2 | ||
| 11 | |||
| 12 | ### Fixed | ||
| 13 | - Resizing the terminal duplicated the prompt: the terminal had already reflowed | ||
| 14 | the block, and the editor then drew a second copy below it. The editor now | ||
| 15 | emits nothing on resize and only recomputes where the caret sits, so the next | ||
| 16 | redraw lands on the reflowed block. | ||
| 17 | - `scripts/ux-check.sh` now also covers narrowing a pane while typing. | ||
| 18 | |||
| 10 | ## 0.6.1 | 19 | ## 0.6.1 |
| 11 | 20 | ||
| 12 | ### Fixed | 21 | ### Fixed |
| @@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" | |||
| 10 | 10 | ||
| 11 | [[package]] | 11 | [[package]] |
| 12 | name = "agent686" | 12 | name = "agent686" |
| 13 | version = "0.6.1" | 13 | version = "0.6.2" |
| 14 | dependencies = [ | 14 | dependencies = [ |
| 15 | "crossterm", | 15 | "crossterm", |
| 16 | "libc", | 16 | "libc", |
| @@ -1,6 +1,6 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "agent686" | 2 | name = "agent686" |
| 3 | version = "0.6.1" | 3 | version = "0.6.2" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | description = "A small coding agent for a 32-bit Debian box" | 5 | description = "A small coding agent for a 32-bit Debian box" |
| 6 | publish = false | 6 | publish = false |
diff --git a/docs/KNOWN-ISSUES.md b/docs/KNOWN-ISSUES.md index 79ce26c..6bc72c6 100644 --- a/docs/KNOWN-ISSUES.md +++ b/docs/KNOWN-ISSUES.md | |||
| @@ -44,11 +44,20 @@ bump, not a sandbox; `bash` has no sandbox by design. | |||
| 44 | `--list`, `--doctor` and `--show` print for humans. A `--json` shape would let | 44 | `--list`, `--doctor` and `--show` print for humans. A `--json` shape would let |
| 45 | scripts consume them. | 45 | scripts consume them. |
| 46 | 46 | ||
| 47 | ## Resize relies on the terminal reflowing | ||
| 48 | |||
| 49 | Already-printed output belongs to the terminal: this harness never re-renders | ||
| 50 | it. Terminals that reflow their scrollback (tmux, VTE, kitty, foot, wezterm) do | ||
| 51 | the right thing on resize, and the input block follows because the caret moves | ||
| 52 | with the text. xterm does not reflow; there a resize can leave the prompt | ||
| 53 | misplaced until you press Enter or Ctrl-C. Making it independent of the terminal | ||
| 54 | would mean owning the screen (alt-screen TUI) or clearing and re-rendering the | ||
| 55 | transcript, which loses scrollback. | ||
| 56 | |||
| 47 | ## Editor gaps | 57 | ## Editor gaps |
| 48 | 58 | ||
| 49 | Wide characters, combining marks and tabs are now measured correctly, and a | 59 | Wide characters, combining marks and tabs are measured correctly. There is still |
| 50 | resize starts a fresh prompt line instead of erasing output. There is still no | 60 | no Ctrl-L redraw and no Ctrl-Z suspend. |
| 51 | Ctrl-L redraw and no Ctrl-Z suspend. | ||
| 52 | 61 | ||
| 53 | ## No session garbage collection | 62 | ## No session garbage collection |
| 54 | 63 | ||
diff --git a/scripts/ux-check.sh b/scripts/ux-check.sh index 019f63d..204fc98 100755 --- a/scripts/ux-check.sh +++ b/scripts/ux-check.sh | |||
| @@ -78,6 +78,30 @@ if echo "$screen" | grep -q 'line two.*Hello from the mock'; then | |||
| 78 | fail_msg "the answer was written on the same line as the prompt" | 78 | fail_msg "the answer was written on the same line as the prompt" |
| 79 | fi | 79 | fi |
| 80 | 80 | ||
| 81 | # Resizing while typing must not duplicate the prompt or erase what is above it. | ||
| 82 | printf 'ZEBRA alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu' \ | ||
| 83 | | tmux load-buffer -b uxresize - | ||
| 84 | tmux paste-buffer -p -b uxresize -t "$session" | ||
| 85 | sleep 0.5 | ||
| 86 | tmux resize-window -t "$session" -x 40 -y 24 | ||
| 87 | sleep 0.6 | ||
| 88 | screen=$(tmux capture-pane -p -t "$session") | ||
| 89 | [ "$(echo "$screen" | grep -c ZEBRA)" -eq 1 ] \ | ||
| 90 | || fail_msg "resizing to 40 columns duplicated the prompt" | ||
| 91 | echo "$screen" | grep -q "Hello from the mock provider" \ | ||
| 92 | || fail_msg "resizing erased the output above the prompt" | ||
| 93 | |||
| 94 | # Typing after the resize must redraw in the right place. | ||
| 95 | tmux send-keys -t "$session" End | ||
| 96 | sleep 0.3 | ||
| 97 | tmux send-keys -t "$session" -l "!" | ||
| 98 | sleep 0.4 | ||
| 99 | screen=$(tmux capture-pane -p -t "$session") | ||
| 100 | [ "$(echo "$screen" | grep -c ZEBRA)" -eq 1 ] \ | ||
| 101 | || fail_msg "redrawing after a resize duplicated the prompt" | ||
| 102 | echo "$screen" | grep -q "Hello from the mock provider" \ | ||
| 103 | || fail_msg "redrawing after a resize erased output above" | ||
| 104 | |||
| 81 | if [ "$fail" -ne 0 ]; then | 105 | if [ "$fail" -ne 0 ]; then |
| 82 | echo "--- final screen ---" >&2 | 106 | echo "--- final screen ---" >&2 |
| 83 | echo "$screen" >&2 | 107 | echo "$screen" >&2 |
diff --git a/src/line.rs b/src/line.rs index 613dffe..2b6c894 100644 --- a/src/line.rs +++ b/src/line.rs | |||
| @@ -58,12 +58,14 @@ impl Editor { | |||
| 58 | draw(prompt, &buffer, cursor, &mut state)?; | 58 | draw(prompt, &buffer, cursor, &mut state)?; |
| 59 | } | 59 | } |
| 60 | Event::Resize(_, _) => { | 60 | Event::Resize(_, _) => { |
| 61 | // The terminal reflowed the block we were tracking, so the | 61 | // The terminal has already reflowed the block and moved the |
| 62 | // old row count is meaningless. Start a fresh prompt line | 62 | // caret with it, so drawing again here would duplicate the |
| 63 | // rather than risk erasing output above it. | 63 | // prompt. Recompute only where the caret now sits relative |
| 64 | println!(); | 64 | // to the block; the next redraw moves up from there. |
| 65 | state = DrawState::default(); | 65 | let width = terminal_width(); |
| 66 | draw(prompt, &buffer, cursor, &mut state)?; | 66 | let (cursor_row, _) = layout(prompt, &buffer, cursor, width); |
| 67 | state.cursor_row = cursor_row; | ||
| 68 | state.rows = layout(prompt, &buffer, buffer.len(), width).0 + 1; | ||
| 67 | } | 69 | } |
| 68 | Event::Key(key) if key.kind == KeyEventKind::Press => { | 70 | Event::Key(key) if key.kind == KeyEventKind::Press => { |
| 69 | match handle_key(key, &mut buffer, &mut cursor, self) { | 71 | match handle_key(key, &mut buffer, &mut cursor, self) { |
