Frank Heckenbach wrote:
Russell Whitaker wrote:
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
If you make the window with a frame around it, (uncomment the framewin line) the characters are printed normally, and afterwards any window written to is also printed normally.
program ncurtest; uses GPC, GPCUtil, CRT, FrameWin;
var submenu : WinState;
Data : array[1..3] of string( 32 ) = ( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789');
i : integer;
begin i := (ScreenSize.X - 32) div 2; MakeWin( SubMenu, i, 2, i + 32, 7 ); { FrameWin('HELP: hit Enter to exit', DoubleFrame ); } FillWin( ' ', 16 * Blue ); HideCursor; for i := 1 to 3 do WriteStrAt( 2,i, Data[ i ], 16 * Blue + LightGray ); end.
Russ
Note to support@slackware.com, bug-ncurses@gnu.org: gpc@gnu.de is a pascal mailing list unit CRT is a pascal interface to ncurses
AFAICS, something was changed WRT A_ALTCHARSET. With previous ncurses versions, one could (apparently) get direct font access with this attribute (e.g. IBM PC character mapping if such a font was loaded, at least on the Linux console). Now some ASCII characters have been redefined with A_ALTCHARSET.
I don't know if the change was intentional (but it appears so, looking at tinfo/lib_acs.c:84-116 in 5.4) or whether A_ALTCHARSET was ever intended to mean what I supposed it did.
Anyway, the affected characters are all printable ASCII characters which are the same, at least in the IBM PC character mapping and probably most other fonts, so if necessary I could just turn off A_ALTCHARSET for those characters (#if 0 in the example below).
Is this the recommended thing to do, or is there another way to get direct access to all characters of the underlying font (on the Linux console)?
#include <ncurses.h>
int main () { unsigned i; initscr (); for (i = 32; i < 256; i++) #if 1 mvaddch (i / 32, i % 32, i | A_ALTCHARSET); #else mvaddch (i / 32, i % 32, (i >= 32 && i < 127) ? i : i | A_ALTCHARSET); #endif getch (); endwin (); return 0; }
If so, Russ, you could try this patch (touch crt.pas after applying to force recompilation):
--- units/crtc.c.orig Sun Apr 10 23:18:13 2005 +++ units/crtc.c Sun Apr 10 23:20:27 2005 @@ -2694,7 +2694,7 @@ } #endif if (!pccs && !_p_IsPrintable (ch)) return ' ';
- return (crt_LinuxConsole && pccs) ? ch | A_ALTCHARSET : ch;
- return (crt_LinuxConsole && pccs && (ch < 32 || ch > 126)) ? ch | A_ALTCHARSET : ch;
}
GLOBAL (void crt_ReadChar (int x, int y, Char *ch, TTextAttr *attr))
Frank
I used to monitor Thomas Dickey's fine ncurses mailing list. He is constantly changing ncurses. (just guessing here ) If slackware got a bad version snapshot you might need to download and install a new version of ncurses. Sometimes that is easier said than done. With SuSE, the RPM database almost forces the installation of the bundled base packages such as ncurses.
Another ncurses issue is your terminfo database. Check out "infocmp" and related terminfo tools. Some distros set up broken terminfo's that need to be modified or rebuilt ( see "tic").
While the ncurses writing scheme might seem overly complex, and a throwback to serial line consoles, it is IMO a real asset and worth learning. The linux console is far and away the most advance console interface (see "console codes").