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. --- x.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'x.c') diff --git a/x.c b/x.c index e0eb263..a82dde9 100644 --- a/x.c +++ b/x.c @@ -69,6 +69,8 @@ static void zoom(const Arg *); static void zoomabs(const Arg *); static void zoomreset(const Arg *); static void ttysend(const Arg *); +void kscrollup(const Arg *); +void kscrolldown(const Arg *); /* config.h for applying patches and the configuration. */ #include "config.h" -- cgit v1.2.3