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

198[vim-multibyte] Re: PATCH: Fix for bold characters spilling over left side in GUI.

Expand Messages
  • Park Chong-Dae
    Mar 24, 2000
      On Fri, Mar 24, 2000 at 12:58:42PM -0000, Robert Webb wrote:
      > I wrote:
      >
      > > I think there was something wrong with this bit of code:
      > >
      > > #ifdef MULTI_BYTE
      > > if (is_dbcs)
      > > {
      > > /* The trick to make a force update */
      > > if (!IsLeadByte(*screenp_from) && IsLeadByte(*screenp_to))
      > > *(screenp_to + 1) = 0;
      > > else if ((char_bytes == 2)
      > > && mb_isbyte1(LinePointers[row], col + 1))
      > > {
      > > *(screenp_to + 1) = 0;
      > > *(screenp_to + 2) = 0;
      > > }
      > > }
      > > #endif
      > >
      > > *screenp_to = *screenp_from;
      > > #ifdef MULTI_BYTE
      > > if (char_bytes == 2)
      > > *(screenp_to + 1) = *(screenp_from + 1);
      > > #endif
      >
      > And Bram replied:
      >
      > > You are missing something: This code checks if the new byte is a
      > > single-byte character while the old byte was a double-byte
      > > character. The next character must be redrawn then, since the right
      > > halve of the double-width character would still be there. The other
      > > situation is when writing a double-width character which overwrites
      > > the left halve of an existing double-width character.
      >
      > OK, so I still don't really understand multi-byte stuff, but the line
      > "*(screenp_to + 1) = 0;" above was redundant, since it only happens
      > when char_bytes is 2, and if char_bytes is 2 then the last part of the
      > above code will change the value of *(screenp_to + 1) again anyway.
      > It's only the line "*(screenp_to + 2) = 0;" which had any effect, and
      > the effect is to redraw the following character.

      Yes. second occuerance of "*(screenp_to + 1) = 0;" is redundant.
      I just leave it there just for readability (Yes. It is better to comment out!)
      and the line "*(screenp_to + 2) = 0" has two important side effects.
      First, it makes to redraw the following character, and second, it makes
      IsLeadByte() to work correctly.

      --
      박종대
      --
      ``Truth is a matter of the imagination.''
      - "The Left Hand of Darkness", Ursula K. LeGuin -
    • Show all 10 messages in this topic