Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/suckless/st/patch/scrollback.c

46 lines
521 B
C
Raw Normal View History

2021-12-28 05:04:49 +00:00
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();
}
2022-09-01 04:45:44 +00:00
if (n > 0)
restoremousecursor();
2021-12-28 05:04:49 +00:00
}
void
kscrollup(const Arg* a)
{
int n = a->i;
if (n < 0)
n = term.row + n;
2022-07-30 22:21:29 +00:00
if (term.scr + n > term.histn)
n = term.histn - term.scr;
2022-07-17 04:28:15 +00:00
if (!n)
return;
2021-12-28 05:04:49 +00:00
if (term.scr <= HISTSIZE-n) {
term.scr += n;
selscroll(0, n);
tfulldirt();
}
2022-09-01 04:45:44 +00:00
if (n > 0)
restoremousecursor();
2021-12-28 05:04:49 +00:00
}