Yasuhiro Matsumoto wrote:

> Copy texts into star register, like: CTRL-V jjjjll "*y,
> getregtype() should return "^V3". On linux environment, it works fine because 
> vim seems to handle changes of clipboard.
> 
> Below is a patch to re-calculate y_width.
> 
> - Yasuhiro Matsumoto
> 
> diff -r b8f703a4e55f src/ops.c
> --- a/src/ops.c       Fri Jul 04 16:43:17 2014 +0200
> +++ b/src/ops.c       Tue Jul 08 19:40:23 2014 +0900
> @@ -906,6 +906,15 @@
>      y_current = &(y_regs[i]);
>      if (writing)     /* remember the register we write into for do_put() */
>       y_previous = y_current;
> +    if (y_current->y_array != NULL && y_current->y_type == MBLOCK)
> +    {
> +     for (i = 0; i < y_current->y_size; ++i)
> +     {
> +         int width = mb_string2cells(y_current->y_array[i], -1) - 1;
> +         if (y_current->y_width < width)
> +             y_current->y_width = width;
> +     }
> +    }
>  }

I'm wondering if this is the right place to do the computation.  It
should only be needed the first time the register is used, after that
the y_width value should already be correct.

Does it work to only compute y_width when "writing" is TRUE?
Or perhaps y_width needs to be set when the register is filled
elsewhere?

Going through all the lines in the register an calling mb_string2cells()
is quite a bit of work.  It should not be done unless needed.

-- 
BEDEVERE: Stand by for attack!!
   [CUT TO enormous army forming up.  Trebuchets, rows of PIKEMEN, siege
   towers, pennants flying, shouts of "Stand by for attack!"  Traditional
   army build-up shots.  The shouts echo across the ranks of the army.
   We see various groups reacting, and stirring themselves in readiness.]
ARTHUR:   Who are they?
BEDEVERE: Oh, just some friends!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui