aboutsummaryrefslogtreecommitdiffstats
path: root/src/sl0ptty.h
diff options
context:
space:
mode:
authorsl0p <sl0p@sl0p.foo>2026-08-13 23:50:24 +0200
committersl0p <sl0p@sl0p.foo>2026-08-13 23:50:24 +0200
commitb514f68d9535e0ee882eecbbac217486f999f538 (patch)
tree1175f74690a61080a8b2d9339335f8b42ef52f05 /src/sl0ptty.h
parentsl0ptty: focus follows the mouse, with the guards that make it liveable (diff)
downloadslosh-b514f68d9535e0ee882eecbbac217486f999f538.tar.gz
slosh-b514f68d9535e0ee882eecbbac217486f999f538.tar.xz
slosh-b514f68d9535e0ee882eecbbac217486f999f538.zip
sl0ptty: scrollback — wheel, keyboard, and a clickable indicator
libghostty-vt already keeps the scrollback, so the work was deciding whose wheel it is: - a program tracking the mouse gets the wheel events themselves; - a full-screen program without mouse tracking (vim, less) has no scrollback of ours to show, so the wheel becomes arrow keys, which is what it means to that program; - anything else scrolls our viewport. All three are tested against real programs rather than asserted in principle. C-a PageUp/PageDown/Home/End, and scroll_lines in the config for the wheel. Typing snaps back to the live view, because reading scrollback and then typing into a screen you are not looking at is a trap. New output does not yank the viewport back — it just grows the gap, which the indicator shows. The indicator is compact, right-aligned, budgeted after the split button and before the title (a title is the thing you can most afford to lose), and clicking it returns to the bottom. Three test failures on the way, all mine and all instructive: the top of the scrollback is the shell's first prompt rather than the first line of output; typing without a newline types rather than runs; and two side-by-side panes share a screen row, so asserting on line(y) reads both frames at once. 341 checks green.
Diffstat (limited to 'src/sl0ptty.h')
-rw-r--r--src/sl0ptty.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sl0ptty.h b/src/sl0ptty.h
index eab209c..71ba72e 100644
--- a/src/sl0ptty.h
+++ b/src/sl0ptty.h
@@ -143,6 +143,13 @@ void pane_send_mouse(pane_t *p, const input_event_t *ev);
void pane_send_paste(pane_t *p, const char *text, size_t len);
void pane_resize(pane_t *p, uint16_t cols, uint16_t rows);
bool pane_dirty(pane_t *p);
+/* Scrollback. Negative delta scrolls up (towards older output). */
+void pane_scroll(pane_t *p, int delta);
+void pane_scroll_edge(pane_t *p, bool top);
+bool pane_scrolled(const pane_t *p);
+void pane_scroll_pos(const pane_t *p, uint32_t *above, uint32_t *total);
+bool pane_alt_screen(const pane_t *p);
+bool pane_wants_mouse(const pane_t *p);
const char *pane_title(const pane_t *p);
const char *pane_status(const pane_t *p);
size_t pane_buttons(const pane_t *p, const pane_button_t **out);