diff options
Diffstat (limited to 'lib/libcurses/tty')
-rw-r--r-- | lib/libcurses/tty/lib_mvcur.c | 60 | ||||
-rw-r--r-- | lib/libcurses/tty/lib_tstp.c | 5 | ||||
-rw-r--r-- | lib/libcurses/tty/lib_vidattr.c | 7 | ||||
-rw-r--r-- | lib/libcurses/tty/tty_update.c | 57 |
4 files changed, 75 insertions, 54 deletions
diff --git a/lib/libcurses/tty/lib_mvcur.c b/lib/libcurses/tty/lib_mvcur.c index 9fbab4a5108..a24ab8ff3e4 100644 --- a/lib/libcurses/tty/lib_mvcur.c +++ b/lib/libcurses/tty/lib_mvcur.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mvcur.c,v 1.6 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: lib_mvcur.c,v 1.7 2000/06/19 03:53:53 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -154,7 +154,7 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$From: lib_mvcur.c,v 1.63 2000/02/13 01:02:34 tom Exp $") +MODULE_ID("$From: lib_mvcur.c,v 1.64 2000/05/14 01:25:28 tom Exp $") #define STRLEN(s) (s != 0) ? strlen(s) : 0 @@ -774,7 +774,7 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) /* tactic #4: use home-down + local movement */ if (cursor_to_ll && ((newcost = relative_move(NULL, screen_lines - 1, 0, ynew, xnew, - ovw)) != INFINITY) + ovw)) != INFINITY) && SP->_ll_cost + newcost < usecost) { tactic = 4; usecost = SP->_ll_cost + newcost; @@ -797,29 +797,33 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) /* * These cases are ordered by estimated relative frequency. */ - if (tactic) { - if (tactic == 1) - (void) relative_move(use, yold, xold, ynew, xnew, ovw); - else if (tactic == 2) { - (void) strcpy(use, carriage_return); - (void) relative_move(use + SP->_carriage_return_length, - yold, 0, ynew, xnew, ovw); - } else if (tactic == 3) { - (void) strcpy(use, cursor_home); - (void) relative_move(use + SP->_cursor_home_length, - 0, 0, ynew, xnew, ovw); - } else if (tactic == 4) { - (void) strcpy(use, cursor_to_ll); - (void) relative_move(use + SP->_cursor_to_ll_length, - screen_lines - 1, 0, ynew, xnew, ovw); - } else { /* if (tactic == 5) */ - use[0] = '\0'; - if (xold > 0) - (void) strcat(use, carriage_return); - (void) strcat(use, cursor_left); - (void) relative_move(use + strlen(use), - yold - 1, screen_columns - 1, ynew, xnew, ovw); - } + switch (tactic) { + case 1: + (void) relative_move(use, yold, xold, ynew, xnew, ovw); + break; + case 2: + (void) strcpy(use, carriage_return); + (void) relative_move(use + SP->_carriage_return_length, + yold, 0, ynew, xnew, ovw); + break; + case 3: + (void) strcpy(use, cursor_home); + (void) relative_move(use + SP->_cursor_home_length, + 0, 0, ynew, xnew, ovw); + break; + case 4: + (void) strcpy(use, cursor_to_ll); + (void) relative_move(use + SP->_cursor_to_ll_length, + screen_lines - 1, 0, ynew, xnew, ovw); + break; + case 5: + use[0] = '\0'; + if (xold > 0) + (void) strcat(use, carriage_return); + (void) strcat(use, cursor_left); + (void) relative_move(use + strlen(use), + yold - 1, screen_columns - 1, ynew, xnew, ovw); + break; } #endif /* !NO_OPTIMIZE */ @@ -1020,7 +1024,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) printf("\" (%ld msec)\n", (long) (after.tv_usec - before.tv_usec + (after.tv_sec - - before.tv_sec) * 1000000)); + before.tv_sec) * 1000000)); } else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) { struct timeval before, after; @@ -1032,7 +1036,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) printf("\" (%ld msec)\n", (long) (after.tv_usec - before.tv_usec + (after.tv_sec - - before.tv_sec) * 1000000)); + before.tv_sec) * 1000000)); } else if (buf[0] == 'r') { (void) strcpy(tname, termname()); load_term(); diff --git a/lib/libcurses/tty/lib_tstp.c b/lib/libcurses/tty/lib_tstp.c index aab402f0223..08c6fec917a 100644 --- a/lib/libcurses/tty/lib_tstp.c +++ b/lib/libcurses/tty/lib_tstp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tstp.c,v 1.5 1999/11/28 17:49:54 millert Exp $ */ +/* $OpenBSD: lib_tstp.c,v 1.6 2000/06/19 03:53:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$From: lib_tstp.c,v 1.20 1999/10/22 23:11:09 tom Exp $") +MODULE_ID("$From: lib_tstp.c,v 1.21 2000/05/20 23:28:56 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -228,6 +228,7 @@ static void cleanup(int sig) && SP->_ofp != 0 && isatty(fileno(SP->_ofp))) { SP->_cleanup = TRUE; + SP->_outch = _nc_outch; } set_term(scan); endwin(); diff --git a/lib/libcurses/tty/lib_vidattr.c b/lib/libcurses/tty/lib_vidattr.c index 9a38f0588f5..9584b26b108 100644 --- a/lib/libcurses/tty/lib_vidattr.c +++ b/lib/libcurses/tty/lib_vidattr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_vidattr.c,v 1.4 2000/03/26 16:45:04 millert Exp $ */ +/* $OpenBSD: lib_vidattr.c,v 1.5 2000/06/19 03:53:54 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -66,7 +66,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_vidattr.c,v 1.26 2000/03/26 02:56:20 tom Exp $"); +MODULE_ID("$From: lib_vidattr.c,v 1.27 2000/04/29 23:25:27 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -121,7 +121,8 @@ vidputs(attr_t newmode, int (*outc) (int)) * If we have a terminal that cannot combine color with video * attributes, use the colors in preference. */ - if ((newmode & A_COLOR) + if (((newmode & A_COLOR) != 0 + || fix_pair0) && (no_color_video > 0)) { /* *INDENT-OFF* */ static const struct { diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c index d0f32008f57..976f5ee8eca 100644 --- a/lib/libcurses/tty/tty_update.c +++ b/lib/libcurses/tty/tty_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_update.c,v 1.8 2000/03/26 16:45:04 millert Exp $ */ +/* $OpenBSD: tty_update.c,v 1.9 2000/06/19 03:53:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -72,7 +72,7 @@ #include <term.h> -MODULE_ID("$From: tty_update.c,v 1.134 2000/03/26 02:17:10 tom Exp $") +MODULE_ID("$From: tty_update.c,v 1.136 2000/05/20 23:28:00 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -183,6 +183,8 @@ GoTo(int const row, int const col) static inline void PutAttrChar(chtype ch) { + int data; + if (tilde_glitch && (TextOf(ch) == '~')) ch = ('`' | AttrOf(ch)); @@ -190,10 +192,11 @@ PutAttrChar(chtype ch) _tracechtype(ch), SP->_cursrow, SP->_curscol)); UpdateAttrs(ch); - if (SP->_cleanup) { - _nc_outch((int) TextOf(ch)); + data = TextOf(ch); + if (SP->_outch != 0) { + SP->_outch(data); } else { - putc((int) TextOf(ch), SP->_ofp); /* macro's fastest... */ + putc(data, SP->_ofp); /* macro's fastest... */ #ifdef TRACE _nc_outchars++; #endif /* TRACE */ @@ -851,18 +854,23 @@ ClrUpdate(void) */ static void -ClrToEOL(chtype blank) +ClrToEOL(chtype blank, bool needclear) { int j; - bool needclear = FALSE; - for (j = SP->_curscol; j < screen_columns; j++) { - chtype *cp = &(curscr->_line[SP->_cursrow].text[j]); + if (curscr != 0 + && SP->_cursrow >= 0 + && SP->_curscol >= 0) { + for (j = SP->_curscol; j < screen_columns; j++) { + chtype *cp = &(curscr->_line[SP->_cursrow].text[j]); - if (*cp != blank) { - *cp = blank; - needclear = TRUE; + if (*cp != blank) { + *cp = blank; + needclear = TRUE; + } } + } else { + needclear = TRUE; } if (needclear) { @@ -872,8 +880,9 @@ ClrToEOL(chtype blank) int count = (screen_columns - SP->_curscol); while (count-- > 0) PutChar(blank); - } else + } else { putp(clr_eol); + } } } @@ -1012,7 +1021,7 @@ TransformLine(int const lineno) if (attrchanged) { /* we may have to disregard the whole line */ GoTo(lineno, firstChar); - ClrToEOL(ClrBlank(curscr)); + ClrToEOL(ClrBlank(curscr), FALSE); PutRange(oldLine, newLine, lineno, 0, (screen_columns - 1)); #if USE_XMC_SUPPORT @@ -1147,7 +1156,7 @@ TransformLine(int const lineno) GoTo(lineno, firstChar); if (newLine[firstChar] != blank) PutChar(newLine[firstChar]); - ClrToEOL(blank); + ClrToEOL(blank, FALSE); } else if ((nLastChar != oLastChar) && (newLine[nLastChar] != oldLine[oLastChar] || !(_nc_idcok && has_ic()))) { @@ -1155,7 +1164,7 @@ TransformLine(int const lineno) if ((oLastChar - nLastChar) > SP->_el_cost) { if (PutRange(oldLine, newLine, lineno, firstChar, nLastChar)) GoTo(lineno, nLastChar + 1); - ClrToEOL(blank); + ClrToEOL(blank, FALSE); } else { n = max(nLastChar, oLastChar); PutRange(oldLine, newLine, lineno, firstChar, n); @@ -1197,7 +1206,7 @@ TransformLine(int const lineno) if (PutRange(oldLine, newLine, lineno, n + 1, nLastNonblank)) GoTo(lineno, nLastNonblank + 1); - ClrToEOL(blank); + ClrToEOL(blank, FALSE); } else { /* * The delete-char sequence will @@ -1458,7 +1467,7 @@ scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) #ifdef NCURSES_EXT_FUNCS if (FILL_BCE()) { for (i = 0; i < n; i++) { - GoTo(bot-i, 0); + GoTo(bot - i, 0); for (j = 0; j < screen_columns; j++) PutChar(blank); } @@ -1514,7 +1523,7 @@ scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) #ifdef NCURSES_EXT_FUNCS if (FILL_BCE()) { for (i = 0; i < n; i++) { - GoTo(top+i, 0); + GoTo(top + i, 0); for (j = 0; j < screen_columns; j++) PutChar(blank); } @@ -1594,7 +1603,7 @@ _nc_scrolln(int n, int top, int bot, int maxy) if (non_dest_scroll_region || (memory_above && top == 0)) { for (i = 0; i < n; i++) { GoTo(i, 0); - ClrToEOL(BLANK); + ClrToEOL(BLANK, FALSE); } } @@ -1638,7 +1647,7 @@ _nc_scrolln(int n, int top, int bot, int maxy) } else if (clr_eol) { for (i = 0; i < -n; i++) { GoTo(maxy + n + i, 0); - ClrToEOL(BLANK); + ClrToEOL(BLANK, FALSE); } } } @@ -1726,6 +1735,12 @@ _nc_screen_wrap(void) SP->_default_color = TRUE; _nc_do_color(-1, 0, FALSE, _nc_outch); SP->_default_color = FALSE; + + mvcur(SP->_cursrow, SP->_curscol, screen_lines - 1, 0); + SP->_cursrow = screen_lines - 1; + SP->_curscol = 0; + + ClrToEOL(BLANK, TRUE); } #endif } |