Loading ...
Sorry, an error occurred while loading the content.

Re: Double width character is displayed as broken.

Expand Messages
  • Bram Moolenaar
    ... Thanks for the clear explanation and the patch! I could reproduce the problem, I ll include the patch. -- Shift happens. -- Doppler /// Bram Moolenaar --
    Message 1 of 4 , Oct 7, 2006
    • 0 Attachment
      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@... -- 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 ///
    Your message has been successfully submitted and would be delivered to recipients shortly.