[prev in list] [next in list] [prev in thread] [next in thread]
List: vim-multibyte
Subject: Re: Double width character is displayed as broken.
From: Bram Moolenaar <Bram () moolenaar ! net>
Date: 2006-10-07 13:32:45
Message-ID: 200610071332.k97DWj78051996 () moolenaar ! net
[Download RAW message or body]
Yukihiro Nakadaira wrote:
> When using GUI and 'encoding' is utf-8, double width character is
> sometimes displayed as broken. I wrote a patch. Please check the
> following.
>
> For example, please look this screenshot.
>
> http://yukihiro.nakadaira.googlepages.com/screenshot.png
>
> There are single width character 'a' and multi-byte character 'A'. And
> 'a' is highlighted.
>
> After double width character 'B' is inserted, the second half of 'B' is
> same value of 'A' (ScreenLinesUC is not cleared. It keeps old value).
>
> offset |0|1|2|3|4|5|
> |a| A |
> |
> | ScreenLinesUC is not cleared.
> v
> offset |0|1|2|3|4|5|
> insert 'B' -> | B |a| A |
> ^ ScreenLinesUC == 'A'
>
> Then, insert NL. Vim clear the line from 'a' to EOL.
>
> +- ScreenLineUC == 'A'
> v
> offset |0|1|2|3|4|5|
> | B |a| A |
> |-----------> to be cleared
>
> If 'a' is highlighted, Vim redraw its previous character ('B'). But Vim
> doesn't care about double width character. Then, wrong offset is used.
>
> First, redraw the previous character with wrong offset.
>
> +----- the first half of 'B'
> | +--- ScreenLineUC[off - 1] == 'A' was drawn
> | | +- off
> v v v
> offset |0|1|2|3|4|5|
> |B| A | A |
> |-----------> to be cleared
>
> Second, clear the rest of line.
>
> +----- the first half of 'B'
> | +--- the first half of 'A'
> | | +- the second half of 'A' was cleared
> v v v
> offset |0|1|2|3|4|5|
> |B|A|
>
> Result, double width character 'B' is displayed as broken.
>
> line 1: |0|1|2|3|4|5|
> line 2: |B|A|
> line 3: |a| A |
Thanks for the clear explanation and the patch! I could reproduce the
problem, I'll include the patch.
--
Shift happens.
-- Doppler
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic