[PATCH] unicode: fix lineedit navigation over wide and combining characters

Tomas Heinrich heinrich.tomas at gmail.com
Tue May 11 20:54:04 UTC 2010


On 05/11/2010 02:47 PM, Denys Vlasenko wrote:
> On Wed, Apr 21, 2010 at 11:22 PM, Tomas Heinrich
> <heinrich.tomas at gmail.com> wrote:
>> Hi,
>>
>> this patch should make cursor movement (C-a, C-e, C-f, ...) over wide and
>> combining unicode characters correct.
>> It depends on the previous patch.
> 
> Please see attached.
> 
> 2.patch is a part which changes how cmdedit_set_out_char works.
> It renames two badly names functions, uses "clear to end of screen"
> to eliminate annoying problems with clearing wide chars, and such.
> Run tested. I will apply it to git. Please review.
> 
> I renamed the function to put_cur_*glyph*_and_inc_cursor, not
> put_cur_*char*_and_inc_cursor, because for combining chars,
> it will print _more than one_ (unicode) char.
> 
> 3.patch is the remainder of your patch. Not reviewed yet.

The changes look good.
I don't think that the function should work with glyphs, though.
It is used at lineedit.c:2273 and processes a single combining char at a 
time. Better places for handling glyphs may be in input_forward(), 
input_delete(), input_backspace() etc, if for example the whole glyph 
should be deleted instead of a single combining character.

I've rewritten the remainder of the patch into two parts:

p1.patch - removes the check for a null byte because the function is not 
used this way anymore and probably shouldn't be.

p2.patch - adds changes to correctly redraw wide/combining utf-8 chars;
moving over e.g. a base character with 10 combining chars following is 
still a bit unintuitive, but the visualization should be correct.

Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100511/28c27075/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.patch
Type: text/x-patch
Size: 2544 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100511/28c27075/attachment-0001.bin>


More information about the busybox mailing list