From 0e2cfe6c4c8208961ce92e300e4b15686b24a3e7 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 6 Nov 1994 15:30:37 +0000 Subject: This curses fix allows to print something in lower right corner if insert_character is available or don't print, if not --- lib/libncurses/lib_doupdate.c | 85 ++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/lib/libncurses/lib_doupdate.c b/lib/libncurses/lib_doupdate.c index 76f69ab..0900ff2 100644 --- a/lib/libncurses/lib_doupdate.c +++ b/lib/libncurses/lib_doupdate.c @@ -42,28 +42,33 @@ static int LRCORNER = FALSE; static inline void PutChar(chtype ch) { T(("puttin %x", ch)); - if (LRCORNER == TRUE) { - if (SP->_curscol == columns-2) { - PutAttrChar(newscr->_line[lines-1][columns-2]); - SP->_curscol++; - return; - } else if (SP->_curscol == columns-1) { + if (LRCORNER == TRUE && SP->_curscol == columns-1) { int i = lines; int j = columns -1; - if (cursor_left) - tputs(cursor_left, 1, _outc); - else - mvcur(-1, -1, i-1, j); - if (enter_insert_mode && exit_insert_mode) { - tputs(enter_insert_mode, 1, _outc); - PutAttrChar(newscr->_line[i-1][j]); - tputs(exit_insert_mode, 1, _outc); - } else if (insert_character) { - tputs(insert_character, 1, _outc); - PutAttrChar(newscr->_line[i-1][j]); - } + + LRCORNER = FALSE; + if ( (!enter_insert_mode || !exit_insert_mode) + && !insert_character + ) return; + if (cursor_left) + tputs(cursor_left, 1, _outc); + else + mvcur(-1, -1, i-1, j); + PutAttrChar(ch); + if (cursor_left) + tputs(cursor_left, 1, _outc); + else + mvcur(-1, -1, i-1, j); + if (enter_insert_mode && exit_insert_mode) { + tputs(enter_insert_mode, 1, _outc); + PutAttrChar(newscr->_line[i-1][columns-2]); + tputs(exit_insert_mode, 1, _outc); + } else if (insert_character) { + tputs(insert_character, 1, _outc); + PutAttrChar(newscr->_line[i-1][columns-2]); } + return; } PutAttrChar(ch); SP->_curscol++; @@ -187,7 +192,6 @@ int lastNonBlank; T(("updating screen from scratch")); for (i = 0; i < lines; i++) { - LRCORNER = FALSE; lastNonBlank = columns - 1; while (scr->_line[i][lastNonBlank] == BLANK ) @@ -198,7 +202,7 @@ int lastNonBlank; /* check if we are at the lr corner */ if (i == lines-1) if ((auto_right_margin) && !(eat_newline_glitch) && - (lastNonBlank == columns-1) && !(scr->_scroll)) + (lastNonBlank == columns-1)) { T(("Lower-right corner needs special handling")); LRCORNER = TRUE; @@ -320,7 +324,7 @@ int attrchanged = 0; /* check if we are at the lr corner */ if (lineno == lines-1) if ((auto_right_margin) && !(eat_newline_glitch) && - (lastChar == columns-1) && !(curscr->_scroll)) + (lastChar == columns-1)) { T(("Lower-right corner needs special handling")); LRCORNER = TRUE; @@ -379,6 +383,15 @@ int attrchanged = 0; vidattr(curscr->_attrs = A_NORMAL); } tputs(clr_eol, 1, _outc); + + /* check if we are at the lr corner */ + if (lineno == lines-1) + if ((auto_right_margin) && !(eat_newline_glitch)) + { + T(("Lower-right corner needs special handling")); + LRCORNER = TRUE; + } + for( k = 0 ; k <= (columns-1) ; k++ ) PutChar(newLine[k]); } else { @@ -404,13 +417,32 @@ int attrchanged = 0; vidattr(curscr->_attrs = A_NORMAL); } tputs(clr_eol,1,_outc); - if(newLine[firstChar] != ' ' ) + + if(newLine[firstChar] != ' ' ) { + /* check if we are at the lr corner */ + if (lineno == lines-1) + if ((auto_right_margin) && !(eat_newline_glitch) && + (firstChar == columns-1)) + { + T(("Lower-right corner needs special handling")); + LRCORNER = TRUE; + } PutChar(newLine[firstChar]); + } } else if( newLine[nLastChar] != oldLine[oLastChar] ) { n = max( nLastChar , oLastChar ); GoTo(lineno, firstChar); + /* check if we are at the lr corner */ + if (lineno == lines-1) + if ((auto_right_margin) && !(eat_newline_glitch) && + (n == columns-1)) + { + T(("Lower-right corner needs special handling")); + LRCORNER = TRUE; + } + for( k=firstChar ; k <= n ; k++ ) PutChar(newLine[k]); } else { @@ -423,6 +455,15 @@ int attrchanged = 0; GoTo(lineno, firstChar); + /* check if we are at the lr corner */ + if (lineno == lines-1) + if ((auto_right_margin) && !(eat_newline_glitch) && + (n == columns-1)) + { + T(("Lower-right corner needs special handling")); + LRCORNER = TRUE; + } + for (k=firstChar; k <= n; k++) PutChar(newLine[k]); -- cgit v1.1