~kris/suckless

st

ref: 3bb3315d3ba370d4db3c84b62d7e5f5b5f7731d3 st/patch/osc133.c -rw-r--r-- 529 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
void
scrolltoprompt(const Arg *arg)
{
	int x, y;
	#if REFLOW_PATCH
	int top = term.scr - term.histf;
	#else
	int top = term.scr - term.histn;
	#endif // REFLOW_PATCH
	int bot = term.scr + term.row-1;
	int dy = arg->i;
	Line line;

	if (!dy || tisaltscr())
		return;

	for (y = dy; y >= top && y <= bot; y += dy) {
		for (line = TLINE(y), x = 0; x < term.col; x++) {
			if (line[x].mode & ATTR_FTCS_PROMPT)
				goto scroll;
		}
	}

scroll:
	if (dy < 0)
		kscrollup(&((Arg){ .i = -y }));
	else
		kscrolldown(&((Arg){ .i = y }));
}