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.

(apply st-scrollback-ringbuffer-0.8.5.diff on top of colorscheme)
This commit is contained in:
Timo Röhling
2023-07-29 01:04:54 +02:00
committed by Łukasz Pankowski
parent 01b6343666
commit 07b35d356c
4 changed files with 250 additions and 126 deletions

1
st.h
View File

@ -19,6 +19,7 @@
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
#define IS_TRUECOL(x) (1 << 24 & (x))
#define HISTSIZE 2000
enum glyph_attribute {
ATTR_NULL = 0,