diff options
author | ache <ache@FreeBSD.org> | 1994-12-02 07:35:48 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-12-02 07:35:48 +0000 |
commit | 8091ade428526edaab100abaf43a77b23f9a6476 (patch) | |
tree | 5a2a1897f1b0f96da62623e7ee2598a2c9d5e1d3 /lib | |
parent | da3bc85e1374c51c5dced6baacf60288a5a3ea40 (diff) | |
download | FreeBSD-src-8091ade428526edaab100abaf43a77b23f9a6476.zip FreeBSD-src-8091ade428526edaab100abaf43a77b23f9a6476.tar.gz |
Implement chage_scroll_region properly
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libncurses/lib_endwin.c | 3 | ||||
-rw-r--r-- | lib/libncurses/lib_scroll.c | 47 | ||||
-rw-r--r-- | lib/libncurses/lib_scrreg.c | 4 |
3 files changed, 36 insertions, 18 deletions
diff --git a/lib/libncurses/lib_endwin.c b/lib/libncurses/lib_endwin.c index fc46222..6d61ea4 100644 --- a/lib/libncurses/lib_endwin.c +++ b/lib/libncurses/lib_endwin.c @@ -27,6 +27,9 @@ endwin() SP->_endwin = TRUE; + if (change_scroll_region) + putp(tparm(change_scroll_region, 0, lines - 1)); + mvcur(-1, -1, lines - 1, 0); if (exit_ca_mode) diff --git a/lib/libncurses/lib_scroll.c b/lib/libncurses/lib_scroll.c index d825c22..81d7189 100644 --- a/lib/libncurses/lib_scroll.c +++ b/lib/libncurses/lib_scroll.c @@ -84,12 +84,11 @@ int i; /* as an optimization, if the scrolling region is the entire screen scroll the physical screen */ - /* should we extend this to include smaller scrolling ranges by using - change_scroll_region? */ if ( win->_begx == 0 && win->_maxx == columns - 1 && !memory_above && !memory_below - && ((win->_regtop == 0 && win->_regbottom == lines - 1 + && ((((win->_begy+win->_regtop == 0 && win->_begy+win->_regbottom == lines - 1) + || change_scroll_region) && ( (n < 0 && (parm_rindex || scroll_reverse)) || (n > 0 && (parm_index || scroll_forward)) ) @@ -109,21 +108,31 @@ int i; if (physical == TRUE) { if (n < 0) { - if ( win->_regtop == 0 && win->_regbottom == lines - 1 + if ( (( win->_begy+win->_regtop == 0 + && win->_begy+win->_regbottom == lines - 1) + || change_scroll_region) && (parm_rindex || scroll_reverse) ) { + if (change_scroll_region && + (win->_begy+win->_regtop != 0 || win->_begy+win->_regbottom == lines - 1) + ) + putp(tparm(change_scroll_region, win->_begy+win->_regtop, win->_begy+win->_regbottom)); i = abs(n); - mvcur(-1, -1, win->_regtop, 0); + mvcur(-1, -1, win->_begy+win->_regtop, 0); if (parm_rindex) { putp(tparm(parm_rindex, i)); } else if (scroll_reverse) { while (i--) putp(scroll_reverse); } + if (change_scroll_region && + (win->_begy+win->_regtop != 0 || win->_begy+win->_regbottom == lines - 1) + ) + putp(tparm(change_scroll_region, 0, lines-1)); } else { i = abs(n); - if (win->_regbottom < lines - 1) { - mvcur(-1, -1, win->_regbottom, 0); + if (win->_begy+win->_regbottom < lines - 1) { + mvcur(-1, -1, win->_begy+win->_regbottom, 0); if (parm_delete_line) { putp(tparm(parm_delete_line, i)); } else if (delete_line) { @@ -132,7 +141,7 @@ int i; i = abs(n); } } - mvcur(-1, -1, win->_regtop, 0); + mvcur(-1, -1, win->_begy+win->_regtop, 0); if (parm_insert_line) { putp(tparm(parm_insert_line, i)); } else if (insert_line) { @@ -141,10 +150,16 @@ int i; } } } else { - if ( win->_regtop == 0 && win->_regbottom == lines - 1 + if ( (( win->_begy+win->_regtop == 0 + && win->_begy+win->_regbottom == lines - 1) + || change_scroll_region) && (parm_index || scroll_forward) ) { - mvcur(-1, -1, win->_regbottom, 0); + if (change_scroll_region && + (win->_begy+win->_regtop != 0 || win->_begy+win->_regbottom == lines - 1) + ) + putp(tparm(change_scroll_region, win->_begy+win->_regtop, win->_begy+win->_regbottom)); + mvcur(-1, -1, win->_begy+win->_regbottom, 0); if (parm_index) { putp(tparm(parm_index, n)); } else if (scroll_forward) { @@ -152,8 +167,12 @@ int i; while (i--) putp(scroll_forward); } + if (change_scroll_region && + (win->_begy+win->_regtop != 0 || win->_begy+win->_regbottom == lines - 1) + ) + putp(tparm(change_scroll_region, 0, lines-1)); } else { - mvcur(-1, -1, win->_regtop, 0); + mvcur(-1, -1, win->_begy+win->_regtop, 0); if (parm_delete_line) { putp(tparm(parm_delete_line, n)); } else if (delete_line) { @@ -161,8 +180,8 @@ int i; while (i--) putp(delete_line); } - if (win->_regbottom < lines - 1) { - mvcur(win->_regtop, 0, win->_regbottom, 0); + if (win->_begy+win->_regbottom < lines - 1) { + mvcur(win->_begy+win->_regtop, 0, win->_begy+win->_regbottom, 0); if (parm_insert_line) { putp(tparm(parm_insert_line, n)); } else if (insert_line) { @@ -174,7 +193,7 @@ int i; } } - mvcur(-1, -1, win->_cury, win->_curx); + mvcur(-1, -1, win->_begy+win->_cury, win->_begx+win->_curx); } else touchline(win, win->_regtop, win->_regbottom - win->_regtop + 1); diff --git a/lib/libncurses/lib_scrreg.c b/lib/libncurses/lib_scrreg.c index b7d9ae2..31bab4f 100644 --- a/lib/libncurses/lib_scrreg.c +++ b/lib/libncurses/lib_scrreg.c @@ -25,10 +25,6 @@ int wsetscrreg(WINDOW *win, int top, int bottom) win->_regbottom = bottom; T(("correctly set scrolling region between %d and %d", top, bottom)); - if (change_scroll_region != NULL) { - T(("changing scroll region")); - putp(tparm(change_scroll_region, top, bottom)); - } return(OK); } else |