[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Corrections for 20021109
From: |
Philippe Blain |
Subject: |
Corrections for 20021109 |
Date: |
Fri, 15 Nov 2002 07:29:18 +0100 |
>From Philippe Blain, Bordeaux, FRANCE.
My old computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0
To maintainers of 'ncurses'.(and to Mr Dickey)
Subject: Corrections for ncurses-5.3-20021109+
Here are some problems I found :
----------------------------------------------------------------------------
File : ncurses/base/tty_update.c
Function : ClearScreen (blank)
The purpose is to clear the screen with the parameter 'blank'.
The important point is 'back_color_erase' (bce) which determins if fast
clear
can be used or not.
1) 'bce' is not a function extension, it's terminal dependant.
( The majority of terminfo entries do not specify bce - 1/10 only ).
So, 'bce' should be considered out of #if NCURSES_EXT_FUNCS ... #endif
Considering the rest of #if NCURSES_EXT_FUNCS ... #endif itself, i don't see
the utility there.
2) There is a boolean function that tells if clear_screen / clr_eos /
clr_eol
can be used for clearing screen with 'blank', depending of 'bce', colors and
modes : 'can_clear_with()'. Better to use it.
3) An hidden bug stay nevertheless under some conditions :
When terminal has bce FALSE (tested with linux-console, setting bce to
false), pb happens at lower right corner.
As Putchar() is used, for the lower right corner we call PutCharLR().
For linux console, we pass in :
..................
} else if ((enter_insert_mode && exit_insert_mode)
|| insert_character || parm_ich) {
GoTo(screen_lines - 1, screen_columns - 2);
PutAttrChar(ch);
GoTo(screen_lines - 1, screen_columns - 2);
==> InsStr(newscr->_line[screen_lines - 1].text + screen_columns - 2, 1);
}
..................
Hence the bug : InsStr() inserts a char coming from newscr instead of
'blank'
while ClearScreen() modifies curscr directly with 'blank'.
This is not visible as function is static.
Need to have a function for inserting one char at cursor position.
Propose these modifs (without point 3 ):
static void ClearScreen(NCURSES_CH_T blank)
{
int i, j;
short fg, bg;
bool fast_clear = (clear_screen || clr_eos || clr_eol);
TR(TRACE_UPDATE, ("ClearScreen() called"));
==> UpdateAttrs(AttrOf(blank)); /* Taking new colors from 'blank' */
==> if (fast_clear && can_clear_with(CHREF(blank))) {
if (clear_screen) {
TPUTS_TRACE("clear_screen");
putp(clear_screen);
SP->_cursrow = SP->_curscol = 0;
position_check(SP->_cursrow, SP->_curscol, "ClearScreen");
}
else if (clr_eos) {
SP->_cursrow = SP->_curscol = -1;
GoTo(0, 0);
TPUTS_TRACE("clr_eos");
putp(clr_eos);
}
else if (clr_eol) {
SP->_cursrow = SP->_curscol = -1;
for (i = 0; i < screen_lines; i++) {
GoTo(i, 0);
TPUTS_TRACE("clr_eol");
putp(clr_eol);
}
GoTo(0, 0);
}
}
else { /* Writing 24x80 = 1920 colored chars */
for (i = 0; i < screen_lines; i++) {
GoTo(i, 0);
for (j = 0; j < screen_columns; j++)
PutChar(CHREF(blank));
}
GoTo(0, 0);
}
/* Memorize on screen changes */
for (i = 0; i < screen_lines; i++) {
for (j = 0; j < screen_columns; j++)
curscr->_line[i].text[j] = blank;
}
TR(TRACE_UPDATE, ("screen cleared"));
}
----------------------------------------------------------------------------
File : ncurses/base/tty_update.c
Function : ClrToEOL ()
Same things, prevent using erase capabilities when 'blank' conflicts with
them or terminal not 'bce'.
Same bug at lower right corner if last line.
static void ClrToEOL (NCURSES_CH_T blank, bool needclear)
{
int j;
if (curscr != 0 && SP->_cursrow >= 0) {
for (j = SP->_curscol; j < screen_columns; j++) {
if (j >= 0) {
NCURSES_CH_T *cp = &(curscr->_line[SP->_cursrow].text[j]);
if (!CharEq (*cp, blank)) {
*cp = blank;
needclear = TRUE;
}
}
}
}
else {
needclear = TRUE;
}
if (needclear) {
UpdateAttrs (AttrOf (blank));
TPUTS_TRACE ("clr_eol");
==> if (clr_eol && can_clear_with (CHREF (blank)) &&
==> (SP->_el_cost <= (screen_columns - SP->_curscol))) {
==> putp (clr_eol);
}
else {
int count = (screen_columns - SP->_curscol);
while (count-- > 0)
PutChar (CHREF (blank));
}
}
}
----------------------------------------------------------------------------
- Philippe
- Corrections for 20021109,
Philippe Blain <=