From d7eec005d9f56384f439a09a92c2d05a571e96e8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 10:24:47 -0300 Subject: Messages: the notice row's left text is cut with `…`, two blanks at least before its right block, the pane's path from the left so its name and line stay (`…/core/Store.zig:1`), a message or a sentence from the right (UX D2, DESIGN.md E5.4: "the notice row cutting a path mid-word into its right block", P1-L 06/07, P3 actions-L: one blank before `5 messages`); TEST FIRST: Messages.zig "the notice row's left is cut with `…` two blanks before its right block at least: the pane's path from the left, its name and line kept; a message from the right" (40 cells, a path of 53 bytes and `1 message · SPC h m`: on the base the row began `/home/someone/pro` with no `…` and one blank before the count); THE CHANGE: noticeRow leaves `width - (right block + 2)` cells to the left text (all of the row when there is no right block), and where the text is wider it keeps `room - 1` cells and a `…`: from the left when the text is the live pane's path:line (no message leads, no picker's sentence), from the right otherwise; the row is still exactly `width` cells (the gap after the cut is 2 or more); a rolled level's last leaf (the whole row, no right block) is as it was; the mouse reads the same row (mouse.zig noticeRow); GOLDENS: 20 regenerated (badutf chordcut edit hscroll layout-open look-file-1col lookloaded lookpanes lsp-rename-files modal msg savepane shellset shrinktag tagalign tagpath ttyedit ttylook wheeldrift wrap), every changed row the notice row and only it: a message cut from the right that ran into its count with one blank (`what the program draw 1 message · SPC h m`) now ends `…` two blanks before it (`what the program dr… 1 message · SPC h m`); no other row moved; core-test 1087/1258 (171 skipped), process-test 20 of 147 failed before the goldens (those 20, all GoldenMismatch), 0 of 103 tty cases after `-- --update` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Messages.zig | 62 ++++++++++++++++++++++++++++++---- test/snapshots/badutf.golden | 2 +- test/snapshots/chordcut.golden | 2 +- test/snapshots/edit.golden | 2 +- test/snapshots/hscroll.golden | 2 +- test/snapshots/layout-open.golden | 4 +-- test/snapshots/look-file-1col.golden | 2 +- test/snapshots/lookloaded.golden | 6 ++-- test/snapshots/lookpanes.golden | 2 +- test/snapshots/lsp-rename-files.golden | 2 +- test/snapshots/modal.golden | 2 +- test/snapshots/msg.golden | 4 +-- test/snapshots/savepane.golden | 2 +- test/snapshots/shellset.golden | 2 +- test/snapshots/shrinktag.golden | 2 +- test/snapshots/tagalign.golden | 4 +-- test/snapshots/tagpath.golden | 2 +- test/snapshots/ttyedit.golden | 2 +- test/snapshots/ttylook.golden | 2 +- test/snapshots/wheeldrift.golden | 2 +- test/snapshots/wrap.golden | 2 +- 21 files changed, 81 insertions(+), 31 deletions(-) diff --git a/core/Messages.zig b/core/Messages.zig index 2cb196f6..725f5a99 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -737,15 +737,35 @@ pub fn noticeRow(p: *const Pardes, width: usize, out: *[notice_row_cap]u8) Row { var keys: [64]u8 = undefined; if (pardes.TagState.pending(p, p.view(), &keys)) |typed| r.print("{s}{s}", .{ if (r.end > 0) " " else "", typed }) catch {}; const tail = r.buffered(); - // The left cut to make room for the right, a blank between them. + // The left cut with `…` to make room for the right, two blanks between + // them at least (UX D2): the pane's path from the left, so its name + // and line stay (`…core/Store.zig:12`), anything else from the right. const tail_w = panes.File.displayWidth(tab, tail); - const room = width -| (tail_w + 1); + const room = width -| (if (tail_w > 0) tail_w + 2 else 0); var cut = left_end; if (panes.File.displayWidth(tab, out[0..cut]) > room) { - cut = panes.File.rawAtDisplay(tab, out[0..left_end], room); - while (cut > 0 and panes.File.displayWidth(tab, out[0..cut]) > room) { - cut -= 1; - while (cut > 0 and out[cut] & 0xC0 == 0x80) cut -= 1; + if (said == null and lead == null) { + var from: usize = 0; + while (from < left_end and panes.File.displayWidth(tab, out[from..left_end]) > room -| 1) { + from += 1; + while (from < left_end and out[from] & 0xC0 == 0x80) from += 1; + } + var kept: [notice_row_cap]u8 = undefined; + const name = kept[0 .. left_end - from]; + @memcpy(name, out[from..left_end]); + w.end = 0; + w.writeAll(if (room > 0) "…" else "") catch {}; + w.writeAll(name) catch {}; + cut = w.end; + } else { + cut = panes.File.rawAtDisplay(tab, out[0..left_end], room -| 1); + while (cut > 0 and panes.File.displayWidth(tab, out[0..cut]) > room -| 1) { + cut -= 1; + while (cut > 0 and out[cut] & 0xC0 == 0x80) cut -= 1; + } + w.end = cut; + w.writeAll(if (room > 0) "…" else "") catch {}; + cut = w.end; } } w.end = cut; @@ -1560,3 +1580,33 @@ test "Esc at rest takes a search's tints first, then the warnings and errors, an try std.testing.expectEqual(@as(u8, 0), p.messages.live_len); try std.testing.expectEqual(id, p.view().active); } + +test "the notice row's left is cut with `…` two blanks before its right block at least: the pane's path from the left, its name and line kept; a message from the right" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + const pane = try p.setTestFile("one\ntwo\n"); + const id = p.view().active; + p.gpa.free(pane.file.?.path); + pane.file.?.path = try p.gpa.dupe(u8, "/home/someone/projects/a/long/way/down/core/Store.zig"); + p.messages.live_len = 0; + p.messages.len = 0; + _ = say(p, .notice, id, "saved"); + p.messages.live_len = 0; + var buf: [notice_row_cap]u8 = undefined; + const tab = p.settings.tab; + // The path and `1 message · SPC h m`: 40 cells. + var row = noticeRow(p, 40, &buf); + try std.testing.expect(std.mem.startsWith(u8, row.text, "…") and std.mem.endsWith(u8, row.text[0..row.left], "/Store.zig:1")); + try std.testing.expect(std.mem.endsWith(u8, row.text, "1 message \u{b7} SPC h m")); + try std.testing.expect(row.right - row.left >= 2); + try std.testing.expectEqual(@as(usize, 40), panes.File.displayWidth(tab, row.text)); + // A live message: cut from the right, `…` at its end. + _ = say(p, .@"error", id, "the build failed because something somewhere went badly wrong"); + row = noticeRow(p, 40, &buf); + try std.testing.expect(std.mem.startsWith(u8, row.text, "\u{2717} ") and std.mem.endsWith(u8, row.text[0..row.left], "…")); + try std.testing.expect(row.right - row.left >= 2); + try std.testing.expect(panes.File.displayWidth(tab, row.text) <= 40); + // Room for it all: nothing cut, no `…`. + row = noticeRow(p, 200, &buf); + try std.testing.expect(std.mem.indexOf(u8, row.text, "…") == null); +} diff --git a/test/snapshots/badutf.golden b/test/snapshots/badutf.golden index 62687621..02a6a159 100644 --- a/test/snapshots/badutf.golden +++ b/test/snapshots/badutf.golden @@ -61,4 +61,4 @@ | | | -| ✓ /tmp/pardes-snap/badutf/c 1 message · SPC h m +| ✓ /tmp/pardes-snap/badutf… 1 message · SPC h m diff --git a/test/snapshots/chordcut.golden b/test/snapshots/chordcut.golden index 8fc71f7e..30c89315 100644 --- a/test/snapshots/chordcut.golden +++ b/test/snapshots/chordcut.golden @@ -30,7 +30,7 @@ | | | -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it ( 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it… 1 message · SPC h m == snap cut grid=120x32 cursor=7,9 |7: */tmp/pardes-snap/chordcut/cwd/f.txt Save Term Collapse Fol |9: 1 1 diff --git a/test/snapshots/edit.golden b/test/snapshots/edit.golden index fb558f5a..fc40c904 100644 --- a/test/snapshots/edit.golden +++ b/test/snapshots/edit.golden @@ -29,7 +29,7 @@ | | | -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m == style inserted grid=100x31 |0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-99 #b2c3b8,#1d2824, diff --git a/test/snapshots/hscroll.golden b/test/snapshots/hscroll.golden index 53b9f68a..7f4d0060 100644 --- a/test/snapshots/hscroll.golden +++ b/test/snapshots/hscroll.golden @@ -29,7 +29,7 @@ | | | -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the p 2 messages · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the… 2 messages · SPC h m == snap wheeled grid=90x31 cursor=52,19 == snap clamped grid=90x31 cursor=52,19 == snap dollar grid=90x31 cursor=86,19 diff --git a/test/snapshots/layout-open.golden b/test/snapshots/layout-open.golden index 51ddea02..45f05c4e 100644 --- a/test/snapshots/layout-open.golden +++ b/test/snapshots/layout-open.golden @@ -30,7 +30,7 @@ | | | -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m == snap altn-left grid=100x32 cursor=4,11 |7: /tmp/pardes-snap/layout-open/cwd Term+bash Save |8: Mode Filter Collapse Del @@ -45,7 +45,7 @@ |22: /tmp/pardes-snap/layout-open/cwd/sub/f.txt Save |23: Term Collapse Follow Del |24: 1 echo 'TTY'OK -|31: · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program dra 2 messages · SPC h m +|31: · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program d… 2 messages · SPC h m == snap ttydir grid=100x32 cursor=7,24 |20: sub /tmp/pardes-snap/layout-open/cwd/sub (echo 'TTY' |21: OK) exit 0 Kill Save Collapse Del diff --git a/test/snapshots/look-file-1col.golden b/test/snapshots/look-file-1col.golden index deedfac1..76f06237 100644 --- a/test/snapshots/look-file-1col.golden +++ b/test/snapshots/look-file-1col.golden @@ -29,4 +29,4 @@ | 44 line 44 | 45 line 45 | 46 line 46 -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m diff --git a/test/snapshots/lookloaded.golden b/test/snapshots/lookloaded.golden index e81a5262..ff90c6eb 100644 --- a/test/snapshots/lookloaded.golden +++ b/test/snapshots/lookloaded.golden @@ -29,12 +29,12 @@ | 40 line 40 | 41 line 41 | 42 line 42 -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m == snap removed grid=100x31 cursor=54,8 |6: rm big.txt; echo GO''NE |7: GONE |21: */tmp/pardes-snap/lookloaded/cwd/big.txt Save Ter -|30: · /tmp/pardes-snap/lookloaded/cwd/big.txt deleted on disk (Save writes it ag 2 messages · SPC h m +|30: · /tmp/pardes-snap/lookloaded/cwd/big.txt deleted on disk (Save writes it … 2 messages · SPC h m == snap look-noFS grid=100x31 cursor=14,26 |8: big.txt:40 big.txt:10 big.txt:10 |23: 7 line 7 @@ -44,4 +44,4 @@ |27: 11 line 11 |28: 12 line 12 |29: 13 line 13 -|30: · @p3 a copy of the terminal's text: Tab or B2 runs it; what the program dra 3 messages · SPC h m +|30: · @p3 a copy of the terminal's text: Tab or B2 runs it; what the program d… 3 messages · SPC h m diff --git a/test/snapshots/lookpanes.golden b/test/snapshots/lookpanes.golden index ece0ed3c..0f1e38a6 100644 --- a/test/snapshots/lookpanes.golden +++ b/test/snapshots/lookpanes.golden @@ -49,7 +49,7 @@ | | | -| · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b typ 1 message · SPC h m +| · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b t… 1 message · SPC h m == snap other-dir grid=130x51 cursor=7,29 |27: ‹@p2 › /tmp/pardes-snap/lookpanes/cwd/alpha/zqonly.txt Keep Sav |28: e Term Collapse Follow Del diff --git a/test/snapshots/lsp-rename-files.golden b/test/snapshots/lsp-rename-files.golden index 6c6c899b..52b8829c 100644 --- a/test/snapshots/lsp-rename-files.golden +++ b/test/snapshots/lsp-rename-files.golden @@ -33,4 +33,4 @@ |20: 5 main.rs:5:13-15 |21: 6 sum |22: ~ -|24: · /tmp/pardes-snap/lsp-rename-files/cwd/lib.rs Rename: 3 edit(s) across file 2 messages · SPC h m +|24: · /tmp/pardes-snap/lsp-rename-files/cwd/lib.rs Rename: 3 edit(s) across fi… 2 messages · SPC h m diff --git a/test/snapshots/modal.golden b/test/snapshots/modal.golden index 2994def1..258549c1 100644 --- a/test/snapshots/modal.golden +++ b/test/snapshots/modal.golden @@ -73,7 +73,7 @@ |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-14 #f5f7ee,#3c614a, 15-49 #f5f7ee,#0d1410, 50-50 #f5f7ee,#608269, 51-99 #f5f7ee,#0d1410, == snap typed grid=100x31 cursor=9,20 |20: TYPED -|30: · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program dra 2 messages · SPC h m +|30: · @p2 a copy of the terminal's text: Tab or B2 runs it; what the program d… 2 messages · SPC h m == snap undone grid=100x31 cursor=4,20 |20: == snap redone grid=100x31 cursor=9,20 diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index 4c6f2308..834d2219 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -58,8 +58,8 @@ |2: */tmp/pardes-snap/msg/cwd/a.txt Save Term Collapse Follow Del |4: 2 |5: 3 Msg hand-written report -|16: · /tmp/pardes-snap/msg/cwd/a.txt hand-written 7 messages · SPC h m +|16: · /tmp/pardes-snap/msg/cwd/a.txt hand-writte… 7 messages · SPC h m == snap msgtail grid=70x17 cursor=32,7 |6: 4 Msg 0123456789 0123456789 0123456789 0123456789 0123456789 012↩ |7: 3456789 0123456789 THE-END -|16: · /tmp/pardes-snap/msg/cwd/a.txt 0123456789 01 9 messages · SPC h m +|16: · /tmp/pardes-snap/msg/cwd/a.txt 0123456789 … 9 messages · SPC h m diff --git a/test/snapshots/savepane.golden b/test/snapshots/savepane.golden index 04b902e1..41c7ca3e 100644 --- a/test/snapshots/savepane.golden +++ b/test/snapshots/savepane.golden @@ -36,7 +36,7 @@ == snap saved grid=100x31 cursor=20,17 |16: /tmp/pardes-snap/savepane/cwd/saved.txt Keep Save Term Collapse Follow Del |17: 1 scratch bytes -|30: · /tmp/pardes-snap/savepane/cwd/+New saved /tmp/pardes-snap/savepane/cwd/sav 3 messages · SPC h m +|30: · /tmp/pardes-snap/savepane/cwd/+New saved /tmp/pardes-snap/savepane/cwd/s… 3 messages · SPC h m == file bytes scratch bytes == end file diff --git a/test/snapshots/shellset.golden b/test/snapshots/shellset.golden index af349c29..2a59619f 100644 --- a/test/snapshots/shellset.golden +++ b/test/snapshots/shellset.golden @@ -22,7 +22,7 @@ | /tmp/pardes-snap/shellset/cwd/cmd.txt:1 == snap builtin-ran grid=90x21 cursor=25,3 |2: ✗/tmp/pardes-snap/shellset/cwd/cmd.txt Keep Save Term Collapse Follow Del -|20: ✗ /tmp/pardes-snap/shellset/cwd/cmd.txt Shell: shell "zznosuchshel 3 messages · SPC h m +|20: ✗ /tmp/pardes-snap/shellset/cwd/cmd.txt Shell: shell "zznosuchsh… 3 messages · SPC h m == snap fallback-shell grid=90x21 cursor=49,6 |1: New Term Find Grep Joincol Delcol New Term Find Grep Joincol Delcol |2: ✗/tmp/pardes-snap/shellset/cwd/cmd.txt Keep /tmp/pardes-snap/shellset/cwd Term+bash Sav diff --git a/test/snapshots/shrinktag.golden b/test/snapshots/shrinktag.golden index 7d57d2b3..ea2260fd 100644 --- a/test/snapshots/shrinktag.golden +++ b/test/snapshots/shrinktag.golden @@ -29,7 +29,7 @@ | | | -| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +| · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m == snap shrunk grid=100x31 cursor=hidden |4: w.txt ls |5: w.txt diff --git a/test/snapshots/tagalign.golden b/test/snapshots/tagalign.golden index 1241b920..e64d7297 100644 --- a/test/snapshots/tagalign.golden +++ b/test/snapshots/tagalign.golden @@ -157,7 +157,7 @@ | | | -| · /tmp/pardes-snap/tagalign/cwd/deep/nested-pro 1 message · SPC h m +| · /tmp/pardes-snap/tagalign/cwd/deep/nested-p… 1 message · SPC h m == snap alone grid=70x31 cursor=4,6 |2: /tmp/pardes-snap/tagalign/cwd Term+bash Save Mode Filter Collapse De |3: l @@ -168,4 +168,4 @@ |8: |9: |10: -|30: ✓ /tmp/pardes-snap/tagalign/cwd/deep/nested-pr 3 messages · SPC h m +|30: ✓ /tmp/pardes-snap/tagalign/cwd/deep/nested-… 3 messages · SPC h m diff --git a/test/snapshots/tagpath.golden b/test/snapshots/tagpath.golden index 02ead66b..9ec3d963 100644 --- a/test/snapshots/tagpath.golden +++ b/test/snapshots/tagpath.golden @@ -77,6 +77,6 @@ |30: ✓ /tmp/pardes-snap/tagpath/cwd/c.txt Last 1 message · SPC h m == snap name-cancelled grid=100x31 cursor=41,3 |2: */tmp/pardes-snap/tagpath/cwd/c.txt Save Term Collapse Follow Del -|30: · /tmp/pardes-snap/tagpath/cwd/c.txt name drafted: Enter renames the buffer, 2 messages · SPC h m +|30: · /tmp/pardes-snap/tagpath/cwd/c.txt name drafted: Enter renames the buffe… 2 messages · SPC h m == snap name-committed grid=100x31 cursor=41,3 |2: */renamed/tmp/pardes-snap/tagpath/cwd/c.txt Save Term Collapse Follow Del diff --git a/test/snapshots/ttyedit.golden b/test/snapshots/ttyedit.golden index 6328c54c..d9f2d8a5 100644 --- a/test/snapshots/ttyedit.golden +++ b/test/snapshots/ttyedit.golden @@ -36,7 +36,7 @@ |9: wo three |10: four five six |11: seven eight nine -|30: · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draw 1 message · SPC h m +|30: · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program dr… 1 message · SPC h m == snap opened grid=100x31 cursor=6,10 |2: /tmp/pardes-snap/ttyedit/cwd Term+bash Save Mode /tmp/pardes-snap/ttyedit/cwd Term+bash Save Mode |10: OPEN diff --git a/test/snapshots/ttylook.golden b/test/snapshots/ttylook.golden index 252640c5..aae39015 100644 --- a/test/snapshots/ttylook.golden +++ b/test/snapshots/ttylook.golden @@ -66,7 +66,7 @@ == snap tokback grid=120x31 cursor=2,5 == snap insert grid=120x31 cursor=4,5 |5: nnbig.txt plain.txt sub big.txt plain.txt sub -|30: · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it ( 1 message · SPC h m +|30: · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it… 1 message · SPC h m == snap tok3 grid=120x31 cursor=22,5 |5: big.txt plain.txt sub big.txt plain.txt sub == snap diropen grid=120x31 cursor=7,22 diff --git a/test/snapshots/wheeldrift.golden b/test/snapshots/wheeldrift.golden index 8efcad3c..30d0f6ab 100644 --- a/test/snapshots/wheeldrift.golden +++ b/test/snapshots/wheeldrift.golden @@ -15,7 +15,7 @@ | 10 line 10_0123456789_abcdefghij_ZEND | 11 line 11_0123456789_abcdefghij_ZEND | 12 line 12_0123456789_abcdefghij_ZEND -| ✓ /tmp/pardes-snap/wheeldrift/cwd/drift.txt Wra 1 message · SPC h m +| ✓ /tmp/pardes-snap/wheeldrift/cwd/drift.txt W… 1 message · SPC h m == snap drifted grid=70x17 cursor=hidden |4: 6 line 6_0123456789_abcdefghij_ZEND |5: 7 line 7_0123456789_abcdefghij_ZEND diff --git a/test/snapshots/wrap.golden b/test/snapshots/wrap.golden index 29a51a33..2940bdb2 100644 --- a/test/snapshots/wrap.golden +++ b/test/snapshots/wrap.golden @@ -31,7 +31,7 @@ |9: |10: |11: -|14: ✓ /tmp/pardes-snap/wrap/c 1 message · SPC h m +|14: ✓ /tmp/pardes-snap/wrap… 1 message · SPC h m == snap on-again grid=48x15 cursor=10,7 |4: 1 0---------1---------2---------3---------↩ |5: 4---------5---------6---------7---------↩ -- cgit v1.3