sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 27a88bd39f26fbc1dee15ffe460fb52ec6ffb797
parent aa29bc47da5858761afb5c0fa75c39cd06539457
Author: SanyaNya <sanyanya4ever@gmail.com>
Date:   Mon, 13 May 2024 18:14:53 +0300

[st][patches][scrollback] Add patch
Use float argument in kscrollup/kscrolldown instead of int
so page can be scrolled more smoothly

Diffstat:
Mst.suckless.org/patches/scrollback/index.md | 5+++++
Ast.suckless.org/patches/scrollback/st-scrollback-float-0.9.2.diff | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/st.suckless.org/patches/scrollback/index.md b/st.suckless.org/patches/scrollback/index.md @@ -19,6 +19,11 @@ efficient scrolling: * [st-scrollback-ringbuffer-0.9.2.diff](st-scrollback-ringbuffer-0.9.2.diff) * [st-scrollback-ringbuffer-0.8.5.diff](st-scrollback-ringbuffer-0.8.5.diff) +Apply the following patch on top of the previous to use float argument in +kscrollup/kscrolldown. + +* [st-scrollback-float-0.9.2.diff](st-scrollback-float-0.9.2.diff) + Apply the following patch on top of the previous to allow column and row reflow. * [st-scrollback-reflow-0.8.5.diff](st-scrollback-reflow-0.8.5.diff) diff --git a/st.suckless.org/patches/scrollback/st-scrollback-float-0.9.2.diff b/st.suckless.org/patches/scrollback/st-scrollback-float-0.9.2.diff @@ -0,0 +1,52 @@ +diff --git a/config.def.h b/config.def.h +index 8b25d40..6769f99 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -201,8 +201,8 @@ static Shortcut shortcuts[] = { + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, +- { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, +- { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, ++ { ShiftMask, XK_Page_Up, kscrollup, {.f = -0.1} }, ++ { ShiftMask, XK_Page_Down, kscrolldown, {.f = -0.1} }, + }; + + /* +diff --git a/st.c b/st.c +index a3b3c9d..5a93594 100644 +--- a/st.c ++++ b/st.c +@@ -1087,14 +1087,14 @@ tswapscreen(void) + void + kscrollup(const Arg *a) + { +- int n = a->i; ++ float n = a->f; + + if (IS_SET(MODE_ALTSCREEN)) + return; + +- if (n < 0) n = (-n) * term.row; ++ if (n < 0) n = MAX((-n) * term.row, 1); + if (n > TSCREEN.size - term.row - TSCREEN.off) n = TSCREEN.size - term.row - TSCREEN.off; +- while (!TLINE(-n)) --n; ++ while (!TLINE((int)-n)) --n; + TSCREEN.off += n; + selscroll(0, n); + tfulldirt(); +@@ -1104,12 +1104,12 @@ void + kscrolldown(const Arg *a) + { + +- int n = a->i; ++ float n = a->f; + + if (IS_SET(MODE_ALTSCREEN)) + return; + +- if (n < 0) n = (-n) * term.row; ++ if (n < 0) n = MAX((-n) * term.row, 1); + if (n > TSCREEN.off) n = TSCREEN.off; + TSCREEN.off -= n; + selscroll(0, -n);