John Beckett wrote:

> > Sometimes I paste some text into the Vim command line
> > (example: type ':echo ' then Ctrl-R a to paste register a).
> >
> > If I accidentally paste a large amount (kilobytes), I have to
> > wait a very long time (several minutes) while Vim struggles
> > to handle the text. Pressing Ctrl-C has no discernible effect.
> 
> Some investigating shows that removing the following call to
> redrawcmd() fixes the problem (this is not a solution, just
> a preliminary observation):
> 
> In function getcmdline() (file ex_getln.c line 1840) we find:
> 
>     /* Always redraw the whole command line to fix shaping and
>      * right-left typing.  Not efficient, but it works. */
>     redrawcmd();
> 
> Removing that redrawcmd() makes accidental pastes of 8000 bytes
> into the command line occur in a second or so. With an unpatched
> Vim, that same paste sometimes seem to complete in a minute, and
> sometimes seems to take forever (I killed it after several
> minutes).
> 
> I have set encoding=utf-8, and I think you need that for the
> above redrawcmd() to be executed.
> 
> While I should not be pasting junk into the command line, Vim
> should not effectively hang if I accidentally do.

The intention of this call to redrawcmd() was to only do this when the
text has characters that are difficult to get right, such as Hebrew and
Arabic.  Unfortunately the option settings are now the default.

I see two possible solutions:
1. Don't redraw when there is text pending, using char_avail().  Need to
   set a flag then and redraw later, before waiting for any character to
   be typed.
2. Don't redraw when the command line contains only "normal" characters.
   Either ASCII or perhaps only redraw when there are composing characters.
   Checking for Arabic is probably a bit too specific.

-- 
Those who live by the sword get shot by those who don't.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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    ///

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

Raspunde prin e-mail lui