bug-ncurses
[Top][All Lists]
Advanced

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

Re: bug: ncurses + slackware 10.0, 10.1


From: Frank Heckenbach
Subject: Re: bug: ncurses + slackware 10.0, 10.1
Date: Sun, 10 Apr 2005 23:22:44 +0200
User-agent: semail 20050409

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 address@hidden, address@hidden:
>   address@hidden 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

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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