diff options
-rw-r--r-- | lib/libncurses/Makefile | 4 | ||||
-rw-r--r-- | lib/libncurses/lib_doupdate.c | 32 | ||||
-rw-r--r-- | lib/libncurses/lib_initscr.c | 19 | ||||
-rw-r--r-- | lib/libncurses/lib_tstp.c | 36 | ||||
-rw-r--r-- | lib/ncurses/ncurses/Makefile | 4 |
5 files changed, 66 insertions, 29 deletions
diff --git a/lib/libncurses/Makefile b/lib/libncurses/Makefile index 5cb0429..8e4d3ea 100644 --- a/lib/libncurses/Makefile +++ b/lib/libncurses/Makefile @@ -1,5 +1,5 @@ # Makefile for ncurses -# $Id: Makefile,v 1.21 1997/02/22 15:07:38 peter Exp $ +# $Id: Makefile,v 1.22 1997/08/24 19:09:32 ache Exp $ LIB= ncurses SHLIB_MAJOR= 3 @@ -15,7 +15,7 @@ SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \ lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \ lib_insstr.c lib_insdel.c lib_twait.c lib_window.c copyright.c -CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO +CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO #-DTRACE DPADD= ${LIBMYTINFO} LDADD= -lmytinfo diff --git a/lib/libncurses/lib_doupdate.c b/lib/libncurses/lib_doupdate.c index 39c8b8f..cf7d284 100644 --- a/lib/libncurses/lib_doupdate.c +++ b/lib/libncurses/lib_doupdate.c @@ -119,6 +119,8 @@ sigaction_t act, oact; if (SP->_endwin == TRUE) { T(("coming back from shell mode")); reset_prog_mode(); + if (enter_ca_mode) + putp(enter_ca_mode); /* is this necessary? */ if (enter_alt_charset_mode) init_acs(); @@ -143,19 +145,17 @@ sigaction_t act, oact; if (curscr->_clear) { /* force refresh ? */ T(("clearing and updating curscr")); - ClrUpdate(curscr); /* yes, clear all & update */ + ClrUpdate(newscr); /* yes, clear all & update */ curscr->_clear = FALSE; /* reset flag */ + } else if (newscr->_clear) { + T(("clearing and updating newscr")); + ClrUpdate(newscr); + newscr->_clear = FALSE; } else { - if (newscr->_clear) { - T(("clearing and updating newscr")); - ClrUpdate(newscr); - newscr->_clear = FALSE; - } else { - T(("Transforming lines")); - for (i = 0; i < lines ; i++) { - if(newscr->_firstchar[i] != _NOCHANGE) - TransformLine(i); - } + T(("Transforming lines")); + for (i = 0; i < lines ; i++) { + if(newscr->_firstchar[i] != _NOCHANGE) + TransformLine(i); } } T(("marking screen as updated")); @@ -213,8 +213,8 @@ int lastNonBlank; } T(("updating screen from scratch")); - for (i = 0; i < lines; i++) { - lastNonBlank = columns - 1; + for (i = 0; i < min(lines, scr->_maxy + 1); i++) { + lastNonBlank = scr->_maxx; while (lastNonBlank >= 0 && scr->_line[i][lastNonBlank] == BLANK) lastNonBlank--; @@ -229,10 +229,9 @@ int lastNonBlank; } for (j = 0; j <= lastNonBlank; j++) { - if (parm_right_cursor) { - static int inspace = 0; + int inspace = 0; - T(("trying to use parm_right_cursor")); + if (parm_right_cursor) { if ((scr->_line[i][j]) == BLANK) { inspace++; continue; @@ -241,6 +240,7 @@ int lastNonBlank; for (; inspace > 0; inspace--) PutChar(scr->_line[i][j-1]); } else { + T(("trying to use parm_right_cursor")); putp(tparm(parm_right_cursor, inspace)); SP->_curscol += inspace; } diff --git a/lib/libncurses/lib_initscr.c b/lib/libncurses/lib_initscr.c index 5c9dfc3..1c2d9e3 100644 --- a/lib/libncurses/lib_initscr.c +++ b/lib/libncurses/lib_initscr.c @@ -15,17 +15,26 @@ WINDOW *initscr() { +static bool initialized = FALSE; +char *name; #ifdef TRACE _init_trace(); T(("initscr() called")); #endif - if (newterm(getenv("TERM"), stdout, stdin) == NULL) - return NULL; - else { - def_shell_mode(); + /* Portable applications must not call initscr() more than once */ + if (!initialized) { + initialized = TRUE; + + if ((name = getenv("TERM")) == 0) + name = "unknown"; + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + exit(1); + } + /* def_shell_mode - done in newterm */ def_prog_mode(); - return(stdscr); } + return(stdscr); } diff --git a/lib/libncurses/lib_tstp.c b/lib/libncurses/lib_tstp.c index 4412dcb..cb96ff0 100644 --- a/lib/libncurses/lib_tstp.c +++ b/lib/libncurses/lib_tstp.c @@ -20,10 +20,27 @@ void tstp(int dummy) { sigaction_t act, oact; -sigset_t mask; +sigset_t mask, omask; T(("tstp() called")); + /* + * The user may have changed the prog_mode tty bits, so save them. + */ + def_prog_mode(); + + /* + * Block window change and timer signals. The latter + * is because applications use timers to decide when + * to repaint the screen. + */ + (void)sigemptyset(&mask); + (void)sigaddset(&mask, SIGALRM); +#ifdef SIGWINCH + (void)sigaddset(&mask, SIGWINCH); +#endif + (void)sigprocmask(SIG_BLOCK, &mask, &omask); + endwin(); sigemptyset(&mask); @@ -41,10 +58,21 @@ sigset_t mask; T(("SIGCONT received")); sigaction(SIGTSTP, &oact, NULL); - reset_prog_mode(); flushinp(); - if (enter_ca_mode) - putp(enter_ca_mode); + + /* + * If the user modified the tty state while suspended, he wants + * those changes to stick. So save the new "default" terminal state. + */ + def_shell_mode(); + + /* + * This relies on the fact that doupdate() will restore the + * program-mode tty state, and issue enter_ca_mode if need be. + */ doupdate(); + + /* Reset the signals. */ + (void)sigprocmask(SIG_SETMASK, &omask, NULL); } diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index 5cb0429..8e4d3ea 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -1,5 +1,5 @@ # Makefile for ncurses -# $Id: Makefile,v 1.21 1997/02/22 15:07:38 peter Exp $ +# $Id: Makefile,v 1.22 1997/08/24 19:09:32 ache Exp $ LIB= ncurses SHLIB_MAJOR= 3 @@ -15,7 +15,7 @@ SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \ lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \ lib_insstr.c lib_insdel.c lib_twait.c lib_window.c copyright.c -CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO +CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO #-DTRACE DPADD= ${LIBMYTINFO} LDADD= -lmytinfo |