bug-ncurses
[Top][All Lists]
Advanced

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

Corrections for 20020907


From: Philippe Blain
Subject: Corrections for 20020907
Date: Mon, 9 Sep 2002 06:40:11 +0200

>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.2-20020907+

Here are some problems I found :

----------------------------------------------------------------------------
File : ncurses/base/lib_screen.c
Function : putwin()

Line 117,       ******  change chtype to NCURSES_CH_T  *******

    for (n = 0; n <= win->_maxy; n++) {
==>     if (fwrite(win->_line[n].text, sizeof(NCURSES_CH_T), len, filep) !=
len
        || ferror(filep))
          returnCode(code);
    }

----------------------------------------------------------------------------
----
File : ncurses/base/lib_screen.c
Function : getwin()

delwin() can delete a pad.
subwin() can create a subpad from a pad.
derwin() idem.
Ok, so saving and restoring a PAD should be possible, too.
Just add some lines :

NCURSES_EXPORT(WINDOW *) getwin(FILE * filep)
{
    ...........................
==> if (tmp->_flags & _ISPAD) {
==>     if ((nwin = newpad(tmp._maxy + 1, tmp._maxx + 1)) == 0)
        returnWin(0);
    else {
        if ((nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0)) == 0)
        returnWin(0);
    }
    ...........................
==> nwin->_flags = tmp._flags & ~(_SUBWIN);
    ...........................

    nwin->_regtop = tmp._regtop;
    nwin->_regbottom = tmp._regbottom;

==> if (tmp->_flags & _ISPAD) {
==>     nwin->_pad = tmp._pad;
==> }
    ...........................
    touchwin(nwin);

    returnWin(nwin);
}

Modify putwin().
Same thing can be done on dupwin(), duplicating a PAD.

----------------------------------------------------------------------------
Function tparam_internal()

Rectify 'number' of pops (if termcap used) :
Line 461, modify :
        ............
        case '>':
            lastpop = -1;
            number += 2;
==>         break;
==>
==>     case '!':
==>     case '~':
==>         lastpop = -1;
==>         number++;  // only one pop for these cases
            break;
        ............

----------------------------------------------------------------------------
----
File : ncurses/tty/lib_mvcur.c

Line 951
Cleaning these useless variables in the movement optimizer code :

NCURSES_EXPORT_VAR(const char *) _nc_progname = "mvcur";

NCURSES_EXPORT_VAR(char) PC = 0;    /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0;    /* used by termcap library
*/
NCURSES_EXPORT_VAR(int) _nc_nulls_sent = 0;    /* used by 'tack' program */
(defined in lib_tputs.c)

----------------------------------------------------------------------------
** PADDING **

Think the configure option --enable-no-padding could be dropped.

>From NEWS - 980509
    + add configure option --enable-no-padding, to allow environment
      variable $NCURSES_NO_PADDING to eliminate non-mandatory padding,
      thereby making terminal emulators (e.g., for vt100) a little more
      efficient (request by Daniel Eisenbud <address@hidden>).

This option does a "#define NCURSES_NO_PADDING 1" when user wants the code
determining if padding must be used.
Since that code is located in lib_mvcur.c and lib_tputs.c only, and due to
the fact that it always relies on testing the SP->_no_padding (TRUE when the
user has defined an environement variable NCURSES_NO_PADDING), it would be
easier for end-user if that light code was already compiled in the library
(matter he or integrator could have forgotten to do).

Just keeping the test on SP->_no_padding everywhere needed.
Padding ON by default (SP->_no_padding = FALSE).
If user wants no padding, he must define a $NCURSES_NO_PADDING.
The line (lib_set_term.c)
        SP->_no_padding = (getenv("NCURSES_NO_PADDING") != 0);
do the job.  That's all.

No need "#if NCURSES_NO_PADDING ........... #endif"

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






reply via email to

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