From 1101a1c287dde44d36f294c3db902e5ec4299b20 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Sun, 2 Mar 2025 06:30:42 -0300 Subject: Terminal scrollback with ring buffer This patch adds a ring buffer for scrollback to the terminal. The advantage of using a ring buffer is that the common case, scrolling with no static screen content, can be achieved very efficiently by incrementing and decrementing the starting line (modulo buffer size). The scrollback buffer is limited to HISTSIZE lines in order to bound memory usage. As the lines are allocated on demand, it is possible to implement unlimited scrollback with few changes. If the terminal is reset, the scroll back buffer is reset, too. --- config.def.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 83aee0e..459690c 100644 --- a/config.def.h +++ b/config.def.h @@ -221,6 +221,8 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { MODKEY, XK_l, copyurl, {.i = 0} }, { MODKEY|ShiftMask, XK_L, copyurl, {.i = 1} }, + { ShiftMask, XK_Page_Up, kscrollup, {.f = -0.1} }, + { ShiftMask, XK_Page_Down, kscrolldown, {.f = -0.1} }, }; /* -- cgit v1.2.3