~kris/suckless

st

ref: 3bb3315d3ba370d4db3c84b62d7e5f5b5f7731d3 st/patch/scrollback.c -rw-r--r-- 758 bytes
3bb3315d — Kris Yotam switch terminal colorscheme to Plan 9 palette, set border to 4px 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
void
kscrolldown(const Arg* a)
{
	int n = a->i;

	if (n < 0)
		n = term.row + n;

	if (n > term.scr)
		n = term.scr;

	if (term.scr > 0) {
		term.scr -= n;
		selscroll(0, -n);
		tfulldirt();
	}

	#if SIXEL_PATCH
	scroll_images(-1*n);
	#endif // SIXEL_PATCH

	#if OPENURLONCLICK_PATCH
	if (n > 0)
		restoremousecursor();
	#endif // OPENURLONCLICK_PATCH
}

void
kscrollup(const Arg* a)
{
	int n = a->i;
	if (n < 0)
		n = term.row + n;

	if (term.scr + n > term.histn)
		n = term.histn - term.scr;

	if (!n)
		return;

	if (term.scr <= HISTSIZE-n) {
		term.scr += n;
		selscroll(0, n);
		tfulldirt();
	}

	#if SIXEL_PATCH
	scroll_images(n);
	#endif // SIXEL_PATCH

	#if OPENURLONCLICK_PATCH
	if (n > 0)
		restoremousecursor();
	#endif // OPENURLONCLICK_PATCH
}