bugGNU Screen - Bugs: bug #63634, GNU Screen should use wcwdith() in...


bug #63634: GNU Screen should use wcwdith() in utf8_isdouble() instead of hard-coded tables

Submitter:  Vincent Lefèvre <vinc17>
Submitted:  Mon 09 Jan 2023 11:17:13 AM UTC
Category:  Feature Request Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Ready For Test
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  5.0.0
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Tue 18 Jun 2024 01:02:23 PM UTC, comment #6: 

comment #3:

> Here's the encoding.diff patch for master. It solves the issue I reported yesterday.
> (file #55015)

Thank you Vincent.

Applied to master: https://git.savannah.gnu.org/cgit/screen.git/commit/?id=9e8e20596f508da866a1e1469b7e6216810dd7f8

Alexander Naumov <anaumov>
Group administrator
Tue 11 Jun 2024 06:50:14 PM UTC, comment #5: 

I like this patch. It seems ok for me.
Does anybody test it?

Alexander Naumov <anaumov>
Group administrator
Tue 26 Mar 2024 03:34:31 AM UTC, comment #4: 

The '➡️' (producable by `echo e29ea1efb88f | xxd -r -p`) seems to mess up the width in screen with or without this patch. Can anyone corroborate whether this is the same issue?

Jae Juang <irisjae>
Mon 07 Aug 2023 08:37:23 AM UTC, comment #3: 

Here's the encoding.diff patch for master. It solves the issue I reported yesterday.

(file #55015)

Vincent Lefèvre <vinc17>
Sun 06 Aug 2023 10:43:27 AM UTC, comment #2: 

Yes, this was for screen-v4.

Concerning master, I cannot reproduce the display issue with my testcase using Mutt, perhaps because the way the display is managed is different in master. But I eventually managed to trigger a display issue in another way: run "screen zsh -f", then enter the wide character several times and go on after the end of the line is reached (since the character isn't available on my keyboard, I do this by pasting it, but this shouldn't matter). When the character is recognized as wide, e.g. U+26FA TENT, everything works fine (possibly except a white rectangle on the last column, depending on the parity of the number of columns, but this is another issue): the characters appear on the second line as expected. But when the character is not recognized as wide, e.g. U+1FAF6 HEART HANDS (the one I used in my testcase with Mutt), the first character after the end of line is reached is displayed on the second line, but the next ones are displayed on the first line again (erasing the prompt at the same time). I'm going to look at the patch and check that this makes this display bug disappear.

Vincent Lefèvre <vinc17>
Thu 03 Aug 2023 10:56:25 AM UTC, comment #1: 

Hi Vincent,
thank you for link to other bug tracking system, but can you attach a patch here (so that everyone can see, review and test it) please?

You're talking about 'screen-v4' branch, right? Can you provide a patch for 'master'?

I like your idea. Just want to be sure that patch doesn't broke anything on other systems.

Alexander Naumov <anaumov>
Group administrator
Mon 09 Jan 2023 11:17:13 AM UTC, original submission:  

In the utf8_isdouble() function of encoding.c, GNU Screen uses hard-coded tables, which become incomplete when Unicode evolves in the C library. This yields major display issues, such as shifted text in Mutt (based on ncurses), with the risk to lose data in this case if one doesn't notice the text shift:


Instead of hard-coded tables, GNU Screen should use the standard wcwdith() function (as done in Debian to fix the above bug), which will ensure consistency with other software that already uses it (the real terminal and perhaps libraries like ncurses). If you think that hard-coded tables are still useful, they could be enabled via an option, a bit like what cjkwidth currently does (introduced for bug #16666 "Support for UAX#11 East Asian Ambiguous characters"). BTW, I don't know whether the cjkwidth feature should be kept, but it is likely to have issues with curses applications.

Vincent Lefèvre <vinc17>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #55015:  encoding.diff added by vinc17 (3KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by irisjae (Posted a comment)
  • -email is unavailable- added by anaumov (Posted a comment)
  • -email is unavailable- added by vinc17 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-10 anaumov StatusConfirmed Ready For Test
        Planned ReleaseNone 5.0.0
    2023-08-07 vinc17 Attached File- Added encoding.diff, #55015
    2023-08-03 anaumov CategoryNone Feature Request
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-1277.
    Corresponding source code