bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Corrections for 20021221


From: Philippe Blain
Subject: Corrections for 20021221
Date: Sat, 28 Dec 2002 07:42:12 +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-20021221+

Here are some problems I found :

----------------------------------------------------------------------------
File : ncurses/base/tty_update.c

Missing some tputs(cap, 0, _nc_outch) not changed in putp() in
_nc_scrolln().
[ grep "0, _nc_outch" *c ]

----------------------------------------------------------------------------
File : ncurses/base/tty_update.c
Line 1713 :
        ................
        if (bot == maxy && clr_eos) {
==>     GoTo(bot - n, 0);
        ClrToEOS(blank2);
        } else {
        for (i = 0; i < n; i++) {
            GoTo(bot - i, 0);
            ClrToEOL(blank2, FALSE);
        }
        ................
Should be GoTo(bot - n + 1, 0);
because in the following 'else{..}', i varies from 0 to n - 1 inclusive
starting from bottom, and so lines 'bot' to 'bot - n + 1' are cleared.

----------------------------------------------------------------------------
File : ncurses/base/tty_update.c

static int ClrBottom (int total)
{
    int row;
    int col;
    int top = total;
    int last = min (screen_columns, newscr->_maxx + 1);
==> NCURSES_CH_T blank = ClrBlank (stdscr);
    bool ok;
        ................

'blank' should be the lower right char of the new screen :
    NCURSES_CH_T blank = newscr->_line[total-1].text[last-1];

It was ok in NC-4.2, but changed since 5.1

Writing
    NCURSES_CH_T blank = ClrBlank (stdscr);
 or NCURSES_CH_T blank = ClrBlank (newscr);
means using the background of stdscr/newscr for the comparison, but in most
cases, this background has not changed since startup (' '|A_NORMAL).
(I suppose usual programmer has no intentions touching stdscr's background).

If now, bottom of screen is colored on a 80 chars wide area (for example
with
a full screen colored window), fast clear is not executed by ClrBottom()
because window color differs with stdscr/newscr's background.
That's why the comparison must be done backward with the last char memorized
in newscr (really independant of background).

----------------------------------------------------------------------------
File : ncurses/base/tty_update.c
Function : can_clear_with()

A more comprehensible and logical rewrite :
    1) putting FIRST the test for being a space.
       (major test, useless to go further if not a space).
    2) testing result of     AttrOfD (ch) & ~(NONBLANK_ATTR | A_COLOR)
       as a BOOLEAN value to see if one bad flag is on, and not with
       BLANK_ATTR = A_NORMAL = 0L since A_NORMAL can be redefined.
    (Not really false because A_NORMAL defined as no bit set)


==>     #define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK)

static inline bool can_clear_with (ARG_CH_T ch)
{
==> if (ISBLANK (CHDEREF (ch))) {
        /* Tests for bce, non-bce terminals */
        if (!back_color_erase && SP->_coloron) {
#if NCURSES_EXT_FUNCS
        ................
#else
            if (AttrOfD (ch) & A_COLOR) return (FALSE);
#endif
        }
==>     return ((AttrOfD (ch) & ~(NONBLANK_ATTR | A_COLOR)) ? FALSE : TRUE);
    }
    else return (FALSE);
}


----------------------------------------------------------------------------
- Philippe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]