summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md9
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--docs/KNOWN-ISSUES.md15
-rwxr-xr-xscripts/ux-check.sh24
-rw-r--r--src/line.rs14
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.
7file, and the tool schemas the model sees. Anything a script or a resumed session 7file, and the tool schemas the model sees. Anything a script or a resumed session
8could depend on counts as API. 8could 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
diff --git a/Cargo.lock b/Cargo.lock
index 8b92fd5..0ce01e2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10 10
11[[package]] 11[[package]]
12name = "agent686" 12name = "agent686"
13version = "0.6.1" 13version = "0.6.2"
14dependencies = [ 14dependencies = [
15 "crossterm", 15 "crossterm",
16 "libc", 16 "libc",
diff --git a/Cargo.toml b/Cargo.toml
index 147541b..38fc125 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "agent686" 2name = "agent686"
3version = "0.6.1" 3version = "0.6.2"
4edition = "2021" 4edition = "2021"
5description = "A small coding agent for a 32-bit Debian box" 5description = "A small coding agent for a 32-bit Debian box"
6publish = false 6publish = 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
45scripts consume them. 45scripts consume them.
46 46
47## Resize relies on the terminal reflowing
48
49Already-printed output belongs to the terminal: this harness never re-renders
50it. Terminals that reflow their scrollback (tmux, VTE, kitty, foot, wezterm) do
51the right thing on resize, and the input block follows because the caret moves
52with the text. xterm does not reflow; there a resize can leave the prompt
53misplaced until you press Enter or Ctrl-C. Making it independent of the terminal
54would mean owning the screen (alt-screen TUI) or clearing and re-rendering the
55transcript, which loses scrollback.
56
47## Editor gaps 57## Editor gaps
48 58
49Wide characters, combining marks and tabs are now measured correctly, and a 59Wide characters, combining marks and tabs are measured correctly. There is still
50resize starts a fresh prompt line instead of erasing output. There is still no 60no Ctrl-L redraw and no Ctrl-Z suspend.
51Ctrl-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"
79fi 79fi
80 80
81# Resizing while typing must not duplicate the prompt or erase what is above it.
82printf 'ZEBRA alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu' \
83 | tmux load-buffer -b uxresize -
84tmux paste-buffer -p -b uxresize -t "$session"
85sleep 0.5
86tmux resize-window -t "$session" -x 40 -y 24
87sleep 0.6
88screen=$(tmux capture-pane -p -t "$session")
89[ "$(echo "$screen" | grep -c ZEBRA)" -eq 1 ] \
90 || fail_msg "resizing to 40 columns duplicated the prompt"
91echo "$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.
95tmux send-keys -t "$session" End
96sleep 0.3
97tmux send-keys -t "$session" -l "!"
98sleep 0.4
99screen=$(tmux capture-pane -p -t "$session")
100[ "$(echo "$screen" | grep -c ZEBRA)" -eq 1 ] \
101 || fail_msg "redrawing after a resize duplicated the prompt"
102echo "$screen" | grep -q "Hello from the mock provider" \
103 || fail_msg "redrawing after a resize erased output above"
104
81if [ "$fail" -ne 0 ]; then 105if [ "$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) {