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

Re: VIM-7.2.394 multibyte related problem?

Expand Messages
  • Dominique Pellé
    ... This bug happens because the :set listchars=precedes:... character printed on the left of the line is interfering with the
    Message 1 of 6 , Apr 10, 2010
    • 0 Attachment
      SungHyun Nam wrote:

      > Hello,
      > With the attached files (vimrc and mb.txt), if I open the mb.txt
      > and just type A,
      >    gvim -u vimrc -U NONE --noplugin mb.txt
      >    A,
      > Now, I should saw (X = cursor):
      >    ....aaaa,X
      > But, I saw
      >    ....aaaa, X
      > It occurs on 3 different versions of gvim,
      > win32/cygwin-gtk2/linux-gtk2.  I included cygwin-gtk2 version info
      > below.
      > Thanks,
      > namsh

      This bug happens because the ':set listchars=precedes:...' character
      printed on the left of the line is interfering with the '<' character
      also printed on the left of the line when a double-width char is
      partially present on the left of the window.

      Another consequence of this bug, is that columns
      in different lines can be displayed misaligned.


      1) Load misaligned.txt attached file (utf-8 file):

      vim -u NONE misalign.txt

      2) Type Ex command:

      :set nu columns=80 tw=0 nowrap listchars=precedes:@ sidescroll=1
      enc=utf-8 fenc=utf-8

      3) Scroll horizontally in command mode with zl and zh

      4) Observe that while scrolling horizontally, vertical
      alignment of columns is not preserved.

      See screenshots before and after scrolling with zl:

      http://dominique.pelle.free.fr/pic/misaligned-1.png (OK)
      http://dominique.pelle.free.fr/pic/misaligned-2.png (BAD!)

      Notice that not only line 4 is not aligned vertically with
      other lines in second screenshot, but the '<' character
      displayed at line 3 should not be there since no
      double-width multi-byte char is truncated at line 3!

      So given these lines in buffer...


      after scrolling horizontally, Vim-7.2.411 currently displays:


      I think that Vim should display this (vertically aligned):


      Looking at the code, it's unclear to me how to implement it.
      win_line() function is quite complicated. The '<' char and '@'
      char (listchar=precedes:@) are printed in screen.c around those


      3872 /* If a double-width char doesn't fit at the left side display
      3873 * a '<' in the first column. */
      3874 if (n_skip > 0 && mb_l > 1)
      3875 {
      3876 n_extra = 1;
      3877 c_extra = '<';


      4326 /*
      4327 * Handle the case where we are in column 0 but not on the first
      4328 * character of the line and the user wants us to show us a
      4329 * special character (via 'listchars' option "precedes:<char>".
      4330 */
      4331 if (lcs_prec_todo != NUL
      4332 && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
      4333 #ifdef FEAT_DIFF
      4334 && filler_todo <= 0
      4335 #endif
      4336 && draw_state > WL_NR
      4337 && c != NUL)
      4338 {
      4339 c = lcs_prec;
      4340 lcs_prec_todo = NUL;
      4341 #ifdef FEAT_MBYTE
      4342 mb_c = c;

      -- Dominique

      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      To unsubscribe, reply using "remove me" as the subject.
    Your message has been successfully submitted and would be delivered to recipients shortly.