summaryrefslogtreecommitdiff
path: root/core/jj.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 05:43:13 -0300
committerGabriel Schneider <[email protected]>2026-11-25 05:43:13 -0300
commitffb06926121d84228c46734579ff47379b126a7b (patch)
tree9efd416529533578c4ba22d1363cb87acb860c3c /core/jj.zig
parent038a94400d668406ed5fab9ad8c00e064365dbb1 (diff)
downloadpardes-ffb06926121d84228c46734579ff47379b126a7b.tar.gz
pardes-ffb06926121d84228c46734579ff47379b126a7b.zip
body_layer, jj: painted targets in place of their lines' numbers (UX DESIGN.md D10, POLISH 11): while a motion root's level shows, a target's keys replace the number on its line, right-aligned to its last digit, as many as the number's cells hold, in the level's order, bold in the key ink on the gutter's ground; the digits are blanked, never drawn over (`cp88`, `f 89`: the keys squeezed into the two cells left of a two-digit number, one cell with three digits, none with four); with no numbers (a +Pager), over the line's first cells on the selection's ground; never a shift; and `]g`/`[g` find an unsaved edit: with no Changes layer shown (no lanes), the last edit not saved yet is a change (jj.nextChange, which the motion and its painted target both ask, so the target and the motion agree; with the layer shown, its pins as before), where an edited file had no `g` target and `]g` went nowhere; TEST FIRST: body_layer.zig's targets test holds D10 (fails on the parent at `p` on line 5's number: `p 5`): the number field holding only the keys, `p` on its last digit's cell in the key ink and bold, the unsaved edit's `g`, the text unshifted, `]g` going to the edit, `g`'s first and last lines, the number back at rest; core-test 1068/1238 (170 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/jj.zig')
-rw-r--r--core/jj.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/jj.zig b/core/jj.zig
index dea0236f..696bd659 100644
--- a/core/jj.zig
+++ b/core/jj.zig
@@ -2033,8 +2033,17 @@ fn ownerOf(ch: *const Changes, f: *const File.State, row: usize) PinIndex {
/// with none shown, or none that way, or none in the `most` lines looked
/// at (a body's painted targets look at the rows shown alone).
pub fn nextChange(p: *Pardes, pane: *const Pane, from: usize, forward: bool, most: usize) ?usize {
- if (pane.layers.lanes == 0) return null;
const f = if (pane.file) |*file| file else return null;
+ // No changes shown: the last edit not saved yet is one (POLISH 11:
+ // `]g` and its painted target found nothing in an edited file).
+ if (pane.layers.lanes == 0) {
+ if (f.revision == f.saved_revision) return null;
+ const at = pane.body.last_edit orelse return null;
+ const line: usize = @intCast(@max(0, at.row));
+ if (forward and line > from and line - from <= most) return line;
+ if (!forward and line < from and from - line <= most) return line;
+ return null;
+ }
const ch = answered(p, f.layer.owner) orelse return null;
const n = File.lineCount(f.content);
var row = from;