On Mon, Sep 01, 2025 at 05:28:17PM +0200, Benno Schulenberg wrote:
> 
> Op 01-09-2025 om 12:08 schreef Thomas Dickey:
> > I think that if you modify render_char, that would be the simplest.
> > Something like a check on wcwidth, and mapping the character to a space.
> 
> Ehm...  I wanted the opposite: _not_ blank characters with a negative
> wcwidth() result.
> 
> The code for that substitution was found in ncurses/tty/tty_update.c,
> in PutAttrChar(), in the first else clause, on line 270:
> 
>             ch = CHREF(blank);
> 
> Commenting out that line makes ncurses behave the way I want.
> 
> Would something like the attached patch be acceptable?  Then I could

ouch.  If it's unknown, then you don't know the size.
It could be an emoji (2 cells) or some pua stuff (anyone's guess).

If ncurses doesn't know the width, it'll get confused when it repaints
the screen.  I don't know how to solve that problem.

> just add the following line to nano, and all users could see unknown
> code points depicted visibly instead of hidden as blanks -- not on an
> xterm, though, but on things like Xfce terminal.
> 
>     putenv("ALLOW_UNASSIGNED_CODEPOINTS=yeah");

The name's kind of long, and doesn't begin with "NCURSES_"
 
> Benno
> 

> diff -ur ncurses-6.5-20250823/ncurses/base/lib_initscr.c 
> ncurses-6.5-20250823-mod/ncurses/base/lib_initscr.c
> --- ncurses-6.5-20250823/ncurses/base/lib_initscr.c   2025-03-09 
> 01:49:14.000000000 +0100
> +++ ncurses-6.5-20250823-mod/ncurses/base/lib_initscr.c       2025-09-01 
> 13:42:43.734485950 +0200
> @@ -66,6 +66,8 @@
>  
>       _nc_globals.init_screen = TRUE;
>  
> +     _nc_globals.pass_all = (getenv("ALLOW_UNASSIGNED_CODEPOINTS") != NULL);
> +
>       env = getenv("TERM");
>       (void) VALID_TERM_ENV(env, "unknown");
>  
> diff -ur ncurses-6.5-20250823/ncurses/term.priv.h 
> ncurses-6.5-20250823-mod/ncurses/term.priv.h
> --- ncurses-6.5-20250823/ncurses/term.priv.h  2024-03-02 21:43:06.000000000 
> +0100
> +++ ncurses-6.5-20250823-mod/ncurses/term.priv.h      2025-09-01 
> 13:40:56.052823691 +0200
> @@ -190,6 +190,7 @@
>  
>       bool            init_signals;
>       bool            init_screen;
> +     bool            pass_all;
>  
>       char *          comp_sourcename;
>       char *          comp_termtype;
> diff -ur ncurses-6.5-20250823/ncurses/tty/tty_update.c 
> ncurses-6.5-20250823-mod/ncurses/tty/tty_update.c
> --- ncurses-6.5-20250823/ncurses/tty/tty_update.c     2024-12-07 
> 19:00:11.000000000 +0100
> +++ ncurses-6.5-20250823-mod/ncurses/tty/tty_update.c 2025-09-01 
> 13:43:30.386372933 +0200
> @@ -255,7 +255,7 @@
>        *    characters.  Codes 128-255 are allowed though this is
>        *    not checked.
>        */
> -     if (is8bits(CharOf(CHDEREF(ch)))
> +     if (_nc_globals.pass_all || (is8bits(CharOf(CHDEREF(ch)))
>           && (!is7bits(CharOf(CHDEREF(ch))) && _nc_unicode_locale())
>           && (isprint(CharOf(CHDEREF(ch)))
>               || (SP_PARM->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160)
> @@ -264,7 +264,7 @@
>                   && ((CharOfD(ch) < ACS_LEN
>                        && SP_PARM->_acs_map != NULL
>                        && SP_PARM->_acs_map[CharOfD(ch)] != 0)
> -                     || (CharOfD(ch) >= 128))))) {
> +                     || (CharOfD(ch) >= 128)))))) {
>           ;
>       } else {
>           ch = CHREF(blank);





-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to