aboutsummaryrefslogtreecommitdiff
path: root/lib/libncurses/lib_insdel.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1998-01-02 04:36:51 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1998-01-02 04:36:51 +0000
commit8bf5c1da2767b37cb7a5ef358b42ce5f87e8498e (patch)
tree152a14c6f9d590088669e8228f7ac2dc06091144 /lib/libncurses/lib_insdel.c
parente2263d244facbc211941607b2da85f608677f349 (diff)
downloadsrc-8bf5c1da2767b37cb7a5ef358b42ce5f87e8498e.tar.gz
src-8bf5c1da2767b37cb7a5ef358b42ce5f87e8498e.zip
1) Redo internal interface to be more latest ncurses-like
2) Fix winsdel called in last line of the window (nothing happens in old variant) 3) Add range checks to wscrl() and internal soft scroll function
Notes
Notes: svn path=/head/; revision=32172
Diffstat (limited to 'lib/libncurses/lib_insdel.c')
-rw-r--r--lib/libncurses/lib_insdel.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/lib/libncurses/lib_insdel.c b/lib/libncurses/lib_insdel.c
index eb30f20a00ea..8729efee8593 100644
--- a/lib/libncurses/lib_insdel.c
+++ b/lib/libncurses/lib_insdel.c
@@ -12,40 +12,20 @@
**
*/
-#include <stdlib.h>
#include "curses.priv.h"
-#include "terminfo.h"
int
winsdelln(WINDOW *win, int n)
{
- int ret, sscroll, stop, sbot;
+int code = ERR;
T(("winsdel(%x,%d) called", win, n));
- if (n == 0)
- return OK;
- if (win->_cury == win->_maxy && abs(n) == 1)
- return wclrtoeol(win);
- if (n < 0 && win->_cury - n > win->_maxy)
- /* request to delete too many lines */
- /* should we truncate to an appropriate number? */
- return ERR;
-
- sscroll = win->_scroll;
- stop = win->_regtop;
- sbot = win->_regbottom;
-
- win->_scroll = TRUE;
- win->_regtop = win->_cury;
- if (win->_regtop > win->_regbottom)
- win->_regbottom = win->_maxy;
-
- ret = wscrl(win, -n);
-
- win->_scroll = sscroll;
- win->_regtop = stop;
- win->_regbottom = sbot;
-
- return ret;
+ if (win) {
+ if (n != 0) {
+ _nc_scroll_window(win, -n, win->_cury, win->_maxy, _nc_background(win));
+ }
+ code = OK;
+ }
+ return code;
}