aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1994-11-06 15:30:37 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1994-11-06 15:30:37 +0000
commit5970372325ab5d6a23f8a8aa1cf21dc89a0ec44c (patch)
treea27fc55c7ff9789205e7f28a9871312cd6076f3a
parent55c92c204098993740afe4afccefd2d6214807b0 (diff)
downloadsrc-5970372325ab5d6a23f8a8aa1cf21dc89a0ec44c.tar.gz
src-5970372325ab5d6a23f8a8aa1cf21dc89a0ec44c.zip
This curses fix allows to print something in lower right corner
if insert_character is available or don't print, if not
Notes
Notes: svn path=/head/; revision=4212
-rw-r--r--lib/libncurses/lib_doupdate.c85
1 files changed, 63 insertions, 22 deletions
diff --git a/lib/libncurses/lib_doupdate.c b/lib/libncurses/lib_doupdate.c
index 76f69ab39c9c..0900ff20a457 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]);