st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

osc133.c (529B)


      1 void
      2 scrolltoprompt(const Arg *arg)
      3 {
      4 	int x, y;
      5 	#if REFLOW_PATCH
      6 	int top = term.scr - term.histf;
      7 	#else
      8 	int top = term.scr - term.histn;
      9 	#endif // REFLOW_PATCH
     10 	int bot = term.scr + term.row-1;
     11 	int dy = arg->i;
     12 	Line line;
     13 
     14 	if (!dy || tisaltscr())
     15 		return;
     16 
     17 	for (y = dy; y >= top && y <= bot; y += dy) {
     18 		for (line = TLINE(y), x = 0; x < term.col; x++) {
     19 			if (line[x].mode & ATTR_FTCS_PROMPT)
     20 				goto scroll;
     21 		}
     22 	}
     23 
     24 scroll:
     25 	if (dy < 0)
     26 		kscrollup(&((Arg){ .i = -y }));
     27 	else
     28 		kscrolldown(&((Arg){ .i = y }));
     29 }