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

Re: visual-K breaks MB

Expand Messages
  • Bram Moolenaar
    ... Thanks for fixing this. I suggest a slightly different solution: ... *************** *** 4952,4966 **** *pp = ml_get_curline(); *lenp = (int)STRLEN(*pp);
    Message 1 of 2 , Oct 31, 2003
    • 0 Attachment
      Taro Muraoka wrote:

      > In character wise visual mode, select some multibyte characters, and
      > press "K", then a last character in the string be passed to 'keywordprg'
      > is broken. I make patch to fix this. Please check it.

      Thanks for fixing this. I suggest a slightly different solution:

      *** ../vim-6.2.140/src/normal.c Wed Oct 29 14:37:09 2003
      --- src/normal.c Fri Oct 31 15:49:58 2003
      ***************
      *** 4952,4966 ****
      *pp = ml_get_curline();
      *lenp = (int)STRLEN(*pp);
      }
      - else if (lt(curwin->w_cursor, VIsual))
      - {
      - *pp = ml_get_pos(&curwin->w_cursor);
      - *lenp = VIsual.col - curwin->w_cursor.col + 1;
      - }
      else
      {
      ! *pp = ml_get_pos(&VIsual);
      ! *lenp = curwin->w_cursor.col - VIsual.col + 1;
      }
      reset_VIsual_and_resel();
      return OK;
      --- 4952,4974 ----
      *pp = ml_get_curline();
      *lenp = (int)STRLEN(*pp);
      }
      else
      {
      ! if (lt(curwin->w_cursor, VIsual))
      ! {
      ! *pp = ml_get_pos(&curwin->w_cursor);
      ! *lenp = VIsual.col - curwin->w_cursor.col + 1;
      ! }
      ! else
      ! {
      ! *pp = ml_get_pos(&VIsual);
      ! *lenp = curwin->w_cursor.col - VIsual.col + 1;
      ! }
      ! #ifdef FEAT_MBYTE
      ! if (has_mbyte)
      ! /* Correct the length to include the whole last character. */
      ! *lenp += (*mb_ptr2len_check)(*pp + (*lenp - 1)) - 1;
      ! #endif
      }
      reset_VIsual_and_resel();
      return OK;


      --
      It is illegal for anyone to try and stop a child from playfully jumping over
      puddles of water.
      [real standing law in California, United States of America]

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.