sites

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

st-scrollback-float-0.9.2.diff (1479B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 8b25d40..6769f99 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -201,8 +201,8 @@ static Shortcut shortcuts[] = {
      6  	{ TERMMOD,              XK_Y,           selpaste,       {.i =  0} },
      7  	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },
      8  	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} },
      9 -	{ ShiftMask,            XK_Page_Up,     kscrollup,      {.i = -1} },
     10 -	{ ShiftMask,            XK_Page_Down,   kscrolldown,    {.i = -1} },
     11 +	{ ShiftMask,            XK_Page_Up,     kscrollup,      {.f = -0.1} },
     12 +	{ ShiftMask,            XK_Page_Down,   kscrolldown,    {.f = -0.1} },
     13  };
     14  
     15  /*
     16 diff --git a/st.c b/st.c
     17 index a3b3c9d..5a93594 100644
     18 --- a/st.c
     19 +++ b/st.c
     20 @@ -1087,14 +1087,14 @@ tswapscreen(void)
     21  void
     22  kscrollup(const Arg *a)
     23  {
     24 -	int n = a->i;
     25 +	float n = a->f;
     26  
     27  	if (IS_SET(MODE_ALTSCREEN))
     28  		return;
     29  
     30 -	if (n < 0) n = (-n) * term.row;
     31 +	if (n < 0) n = MAX((-n) * term.row, 1);
     32  	if (n > TSCREEN.size - term.row - TSCREEN.off) n = TSCREEN.size - term.row - TSCREEN.off;
     33 -	while (!TLINE(-n)) --n;
     34 +	while (!TLINE((int)-n)) --n;
     35  	TSCREEN.off += n;
     36  	selscroll(0, n);
     37  	tfulldirt();
     38 @@ -1104,12 +1104,12 @@ void
     39  kscrolldown(const Arg *a)
     40  {
     41  
     42 -	int n = a->i;
     43 +	float n = a->f;
     44  
     45  	if (IS_SET(MODE_ALTSCREEN))
     46  		return;
     47  
     48 -	if (n < 0) n = (-n) * term.row;
     49 +	if (n < 0) n = MAX((-n) * term.row, 1);
     50  	if (n > TSCREEN.off) n = TSCREEN.off;
     51  	TSCREEN.off -= n;
     52  	selscroll(0, -n);