Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libcurses/addbytes.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libcurses/addbytes.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.54 retrieving revision 1.55 diff -u -p -r1.54 -r1.55 --- src/lib/libcurses/addbytes.c 2021/02/13 14:30:37 1.54 +++ src/lib/libcurses/addbytes.c 2021/06/06 05:06:44 1.55 @@ -1,4 +1,4 @@ -/* $NetBSD: addbytes.c,v 1.54 2021/02/13 14:30:37 rillig Exp $ */ +/* $NetBSD: addbytes.c,v 1.55 2021/06/06 05:06:44 blymn Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: addbytes.c,v 1.54 2021/02/13 14:30:37 rillig Exp $"); +__RCSID("$NetBSD: addbytes.c,v 1.55 2021/06/06 05:06:44 blymn Exp $"); #endif #endif /* not lint */ @@ -170,6 +170,15 @@ _cursesi_waddbytes(WINDOW *win, const ch } else if (wc == 0) { break; } + + /* if scrollok is false and we are at the bottom of + * screen and this character would take us past the + * end of the line then we are done. + */ + if ((win->curx + n >= win->maxx) && + (!(win->flags & __SCROLLOK)) && + (win->cury == win->scr_b)) + break; #ifdef DEBUG __CTRACE(__CTRACE_INPUT, "ADDBYTES WIDE(0x%x [%s], %x) at (%d, %d), ate %d bytes\n", @@ -214,6 +223,19 @@ _cursesi_addbyte(WINDOW *win, __LINE **l case '\t': tabsize = win->screen->TABSIZE; newx = tabsize - (*x % tabsize); + /* if at the bottom of the window and + not allowed to scroll then just do + what we can */ + if ((*y == win->scr_b) && + !(win->flags & __SCROLLOK)) { + if ((*lp)->flags & __ISPASTEOL) { + return OK; + } + + if (*x + newx > win->maxx - 1) + newx = win->maxx - *x - 1; + } + for (i = 0; i < newx; i++) { if (waddbytes(win, blank, 1) == ERR) return ERR; @@ -366,6 +388,20 @@ _cursesi_addwchar(WINDOW *win, __LINE ** cc.attributes = win->wattr; tabsize = win->screen->TABSIZE; newx = tabsize - (*x % tabsize); + + /* if at the bottom of the window and + not allowed to scroll then just do + what we can */ + if ((*y == win->scr_b) && + !(win->flags & __SCROLLOK)) { + if ((*lnp)->flags & __ISPASTEOL) { + return OK; + } + + if (*x + newx > win->maxx - 1) + newx = win->maxx - *x - 1; + } + for (i = 0; i < newx; i++) { if (wadd_wch(win, &cc) == ERR) return ERR;