diff options
| -rw-r--r-- | src/pardes.zig | 12 | ||||
| -rw-r--r-- | test/snapshots/cursorline.golden | 124 | ||||
| -rw-r--r-- | test/snapshots/cursorline.snap | 25 | ||||
| -rw-r--r-- | test/snapshots/look-file.golden | 2 | ||||
| -rw-r--r-- | test/snapshots/syntax.golden | 6 |
5 files changed, 164 insertions, 5 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index c4893b25..23c6869a 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -3288,14 +3288,24 @@ pub const Pardes = struct { // file line-number gutter: mute the first PREFIX_W columns. Cheap // chrome, not gated on colors_on; selection/cursor passes still win. + // The cursor row's number takes the tag style (same row math as the + // cursor pass below) so the eye finds the current line. if (pane.file != null) { + const goff = pane.scroll(); + const gcur = pane.vt.screens.active.cursor; + const gcrow = if (pane.cur_pinned) pane.cur_row else @as(i32, @intCast(gcur.y)) + goff; + const cur_vr: i32 = if (active and !pane.tag_edit) gcrow - goff else -1; var vr: u16 = 0; while (vr < body_h) : (vr += 1) { + const on_cursor = @as(i32, vr) == cur_vr; var c: u16 = 0; while (c < PREFIX_W and c < tw) : (c += 1) { const cell = s.at(tx + c, r.y + BOX_H + vr); cell.default = false; // paints blank gutter rows too - cell.style.fg = .{ .rgb = th.lineno }; + if (on_cursor) { + cell.style.fg = .{ .rgb = th.tag_fg }; + cell.style.bg = .{ .rgb = th.tag_bg }; + } else cell.style.fg = .{ .rgb = th.lineno }; } } } diff --git a/test/snapshots/cursorline.golden b/test/snapshots/cursorline.golden new file mode 100644 index 00000000..f50617c8 --- /dev/null +++ b/test/snapshots/cursorline.golden @@ -0,0 +1,124 @@ +== snap top grid=100x30 cursor=7,2 +|Kill Newcol Tutor Debug Colors NextColor Dump +| nm /tmp/pardes-snap/cursorline/cwd/cur.txt Save nm /tmp/pardes-snap/cursorline/cwd Del +| 1 line 1 +| 2 line 2 cur.txt +| 3 line 3 +| 4 line 4 +| 5 line 5 +| 6 line 6 +| 7 line 7 +| 8 line 8 +| 9 line 9 +| nm /tmp/pardes-snap/cursorline/cwd Del +| +| cur.txt +| +| +| +| cur.txt +| +| +| +| nm /tmp/pardes-snap/cursorline/cwd Del +| +| cur.txt +| +| +| +| +| +| +== style top +|0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, +|1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-89 #969696,#2c2a3e, 90-99 d,#2c2a3e, +|2: 0-1 d,#525252, 2-6 #969696,#2c2a3e, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|3: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|4: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|5: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|6: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|7: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|8: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|9: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|10: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|11: 0-1 d,#383c54, 2-39 #969696,#2c2a3e, 40-49 d,#2c2a3e, 50-51 d,#525252, 52-99 d,d, +|12: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|13: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|14: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|15: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|16: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|17: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|18: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|19: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|20: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|21: 0-1 d,#383c54, 2-39 #969696,#2c2a3e, 40-49 d,#2c2a3e, 50-51 d,#525252, 52-99 d,d, +|22: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|23: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|24: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|25: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|26: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|27: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|28: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|29: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +== snap down3 grid=100x30 cursor=7,5 +|Kill Newcol Tutor Debug Colors NextColor Dump +| nm /tmp/pardes-snap/cursorline/cwd/cur.txt Save nm /tmp/pardes-snap/cursorline/cwd Del +| 1 line 1 +| 2 line 2 cur.txt +| 3 line 3 +| 4 line 4 +| 5 line 5 +| 6 line 6 +| 7 line 7 +| 8 line 8 +| 9 line 9 +| nm /tmp/pardes-snap/cursorline/cwd Del +| +| cur.txt +| +| +| +| cur.txt +| +| +| +| nm /tmp/pardes-snap/cursorline/cwd Del +| +| cur.txt +| +| +| +| +| +| +== style down3 +|0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, +|1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-89 #969696,#2c2a3e, 90-99 d,#2c2a3e, +|2: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|3: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|4: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|5: 0-1 d,#2a2a2a, 2-6 #969696,#2c2a3e, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|6: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|7: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|8: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|9: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|10: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|11: 0-1 d,#383c54, 2-39 #969696,#2c2a3e, 40-49 d,#2c2a3e, 50-51 d,#525252, 52-99 d,d, +|12: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|13: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|14: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|15: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|16: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|17: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|18: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|19: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|20: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|21: 0-1 d,#383c54, 2-39 #969696,#2c2a3e, 40-49 d,#2c2a3e, 50-51 d,#525252, 52-99 d,d, +|22: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|23: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|24: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|25: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|26: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|27: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|28: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, +|29: 0-1 d,#525252, 2-49 d,d, 50-51 d,#525252, 52-99 d,d, diff --git a/test/snapshots/cursorline.snap b/test/snapshots/cursorline.snap new file mode 100644 index 00000000..f9b3de5b --- /dev/null +++ b/test/snapshots/cursorline.snap @@ -0,0 +1,25 @@ +# cursor-line gutter: the line number on the cursor's row takes the tag style +# and follows modal movement (gg to the top, then jjj down three lines) +lines cur.txt 20 +start 30 100 +wait 8000 cur.txt +stable 700 20000 +press left 5 8 +release left 5 8 +stable 400 5000 +key i +text cur.txt +key esc +settle 700 +stable 400 5000 +press right 6 8 +release right 6 8 +stable 700 15000 +key g g +stable 400 5000 +snap top +snapstyle top +key j j j +stable 400 5000 +snap down3 +snapstyle down3 diff --git a/test/snapshots/look-file.golden b/test/snapshots/look-file.golden index 4f6d4a71..0b9f08cd 100644 --- a/test/snapshots/look-file.golden +++ b/test/snapshots/look-file.golden @@ -32,7 +32,7 @@ == style file-open |0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, |1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-88 #969696,#2c2a3e, 89-99 d,#2c2a3e, -|2: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|2: 0-1 d,#2a2a2a, 2-6 #969696,#2c2a3e, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |3: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |4: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |5: 0-1 d,#2a2a2a, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, diff --git a/test/snapshots/syntax.golden b/test/snapshots/syntax.golden index 310d6d64..372f2999 100644 --- a/test/snapshots/syntax.golden +++ b/test/snapshots/syntax.golden @@ -32,7 +32,7 @@ == style zig-open |0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, |1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-85 #969696,#2c2a3e, 86-99 d,#2c2a3e, -|2: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-18 d,d, 19-25 #cc70d8,d,b 26-26 d,d, 27-31 #8ab87a,d, 32-34 d,d, 35-42 #f0f0f0,d,b 43-49 d,d, 50-51 d,#525252, 52-99 d,d, +|2: 0-1 d,#525252, 2-6 #969696,#2c2a3e, 7-18 d,d, 19-25 #cc70d8,d,b 26-26 d,d, 27-31 #8ab87a,d, 32-34 d,d, 35-42 #f0f0f0,d,b 43-49 d,d, 50-51 d,#525252, 52-99 d,d, |3: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-10 d,d, 11-12 #cc70d8,d,b 13-49 d,d, 50-51 d,#525252, 52-99 d,d, |4: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-23 d,d, 24-25 #d0c070,d, 26-49 d,d, 50-51 d,#525252, 52-99 d,d, |5: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, @@ -63,7 +63,7 @@ == style colors-off |0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, |1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-85 #969696,#2c2a3e, 86-99 d,#2c2a3e, -|2: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, +|2: 0-1 d,#525252, 2-6 #969696,#2c2a3e, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |3: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |4: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |5: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, @@ -94,7 +94,7 @@ == style colors-on |0: 0-44 #969696,#2c2a3e, 45-99 d,#2c2a3e, |1: 0-1 d,#6e4fd0, 2-49 #969696,#2c2a3e, 50-51 d,#383c54, 52-85 #969696,#2c2a3e, 86-99 d,#2c2a3e, -|2: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-18 d,d, 19-25 #cc70d8,d,b 26-26 d,d, 27-31 #8ab87a,d, 32-34 d,d, 35-42 #f0f0f0,d,b 43-49 d,d, 50-51 d,#525252, 52-99 d,d, +|2: 0-1 d,#525252, 2-6 #969696,#2c2a3e, 7-18 d,d, 19-25 #cc70d8,d,b 26-26 d,d, 27-31 #8ab87a,d, 32-34 d,d, 35-42 #f0f0f0,d,b 43-49 d,d, 50-51 d,#525252, 52-99 d,d, |3: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-10 d,d, 11-12 #cc70d8,d,b 13-49 d,d, 50-51 d,#525252, 52-99 d,d, |4: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-23 d,d, 24-25 #d0c070,d, 26-49 d,d, 50-51 d,#525252, 52-99 d,d, |5: 0-1 d,#525252, 2-6 #5a5a5a,d, 7-49 d,d, 50-51 d,#525252, 52-99 d,d, |
