On Fri, Apr 24, 2026 at 12:19:18 -0400, Chet Ramey wrote:
> On 4/21/26 11:10 AM, Alan Mackenzie wrote:

> >>> (iii) Type "abc" directly after this full width character.  "c" should be
> >>>     the last character on the line.
> >>> (iv) Type <Ctrl-a>, and type further characters or press <Delete> until
> >>>     the U+2614's ? is at the right edge of the screen.  The "abc" will be
> >>>     on a continuation line.

> >>> (v) Type <Ctrl-e> to go to EOL.  There is a spurious space between the
> >>>     "c" and the cursor.  This looks like a bug.

> >> I can't reproduce this using macOS Terminal, which correctly displays the
> >> Unicode character. I imagine your terminal will, too, when you're
> >> finished.

> > I've found the source of the bug, and have a simple fix for it.

> I can't reproduce any of this behavior on macOS. 

I've spent some while trying to work out how readline could work on
macOS, and not show the bugs I find on GNU/Linux and by reviewing the
source.

For the avoidance of doubt, the locale and the font I have been using
match eachother, and wcwidth(char) matches the width of char coded in the
font for all characters.

As I said in my post of 21 April containing the patch, on GNU/Linux, when
a full-width character tries to span a linefeed, an extra space gets
inserted into the invisible buffer (and later onto the screen) to push
that character fully onto the next line.  (display.c L1201).  This works.
In function update_line (display.c L1821) a further space is inserted,
but to the screen only, not to the invisible buffer.  This must be wrong.
It throws off the synchronisation between the invisible buffer and the
screen contents.

I have failed to come up with a theory of how this could work properly on
macOS.  When the screen contents no longer match the buffer, it cannot go
well.  This is a mystery to me.

Just as a matter of interest, how does readline work on macOS after
applying the patch I submitted on Apr 21?  Does it show any buggy
behaviour not present without the patch?

> When I find a system where I can reproduce it, I'll look at this again.

The bug is present in readline on GNU/Linux.  If you don't have access to
a G/L system, may I suggest you investigate it on my system by sending me
things to try, questions, and patches to try?

> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

-- 
Alan Mackenzie (Nuremberg, Germany).

Reply via email to