diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 02:00:44 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 02:00:44 -0300 |
| commit | 7ec51e48d430d4bc06869c09c6cc1325124ac338 (patch) | |
| tree | 8a7cdf9fe0ae6eda0f9d013f62b04f693e6a367c /core | |
| parent | 5e30bc2d390a809e0baddaee6eedd5052a556524 (diff) | |
| parent | 808efd09c7bbd4ca055463ae95ca4c2f5f474085 (diff) | |
| download | pardes-7ec51e48d430d4bc06869c09c6cc1325124ac338.tar.gz pardes-7ec51e48d430d4bc06869c09c6cc1325124ac338.zip | |
integration: nothing of a core a process global and the rollback's two faults fixed, with the gutter's ~ for the slot after a text's last newline: pardes-globals (the faults a closed terminal's kitty image and a far client's own Del of a non-plain kind's pane each crashed a client on after a rollback; config.tab_now, Addon's distrust list and Kind's draw tokens into the core; the check in core/root.zig) and pardes-tilde, merged without a conflict; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
| -rw-r--r-- | core/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | core/File.zig | 14 | ||||
| -rw-r--r-- | core/body_layer.zig | 3 |
3 files changed, 18 insertions, 2 deletions
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 5fcfd378..1b28267e 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- The row after a file's last newline, where the cursor can sit and no + line is yet, shows `~` in the gutter where its line number was, as + helix's does. - `pardes` has commands, and they describe themselves: `ps`, `attach`, `kill` and `new` for sessions, `do WORD` and `words` for the builtins, `fs ls|read|write|ask|follow|stat|help|complete PATH` for the tree (a diff --git a/core/File.zig b/core/File.zig index b21dac78..36e014b3 100644 --- a/core/File.zig +++ b/core/File.zig @@ -334,6 +334,13 @@ pub fn byteAtRowDisplay(tab: u16, pane: *const Pane, row: i32, from_raw: i32, di return @intCast(byteAtDisplayFrom(tab, line_text, @intCast(@max(0, from_raw)), @intCast(@max(0, display_col)))); } +/// The slot after a text's last newline: a line the cursor can sit on that +/// is not there yet. Its gutter shows `~` for a number, as helix's does. +pub fn endSlot(pane: *const Pane, row: usize) bool { + const f = if (pane.file) |*file| file else return false; + return row > 0 and row + 1 == f.line_starts.len and f.line_starts[row] == f.content.len; +} + pub fn gutterWidth(pane: *const Pane) u16 { if (pane.file == null) return 0; const file = &pane.file.?; @@ -1734,6 +1741,9 @@ fn fillBody(tab: u16, dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_w if (record_wrap) pane.wrap_n = 0; const prefix_width = gutterWidth(pane); const total = nlines(pane.gpa, f); + // The slot after the text's last newline, found once: every numbered + // row below asks whether it is that one. + const end_slot: usize = if (total > 0 and endSlot(pane, total - 1)) total - 1 else std.math.maxInt(usize); var body_line: usize = f.scroll; var body_at: usize = 0; var written: usize = 0; @@ -1773,7 +1783,9 @@ fn fillBody(tab: u16, dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_w if (at == 0 and prefix.len > 0) { var lineno = row + 1; var digit: usize = prefix.len - 1; - while (true) { + if (row == end_slot) { + prefix[digit - 1] = '~'; + } else while (true) { digit -= 1; prefix[digit] = '0' + @as(u8, @intCast(lineno % 10)); lineno /= 10; diff --git a/core/body_layer.zig b/core/body_layer.zig index 73c9dd48..7dc097ad 100644 --- a/core/body_layer.zig +++ b/core/body_layer.zig @@ -250,7 +250,8 @@ fn drawGutter(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw: const row_line: i32 = if (pane.wrap_n == 0) goff + @as(i32, vr) else if (vr < pane.wrap_n) pane.wrap_line[vr] else std.math.maxInt(i32); - const on_cursor = row_line == cur_line; + // The `~` of the slot past the text is no line's number: never lit. + const on_cursor = row_line == cur_line and row_line >= 0 and !panes.File.endSlot(pane, @intCast(row_line)); var c: u16 = 0; while (c < prefix_width and c < tw) : (c += 1) { const cell = s.at(tx + c, body_y + vr); |
