Monday, August 23, 2010

Re: Preventing accidental command-line pastes from destroying the universe

Hi Ted!

On Mo, 23 Aug 2010, Ted wrote:

> Hi all,
> Note that this is *not* a vim 7.3-related issue -- I'm still running
> 7.2. I'm using the ubuntu 10.04 `vim-gnome` package.
>
> I've noticed that pasting into the command line from a register uses
> a conspicuous amount of resources, both in terms of processing time
> and memory. This can easily clog up the operation of a machine, and
> can happen quite easily if you just hit the wrong key by accident. It
> happens very slowly, taking up to a second just to paste in one screen
> row's worth of text.
>
> Today I accidentally pasted the entire jQuery source code into the
> vim command line by pressing `<C-R>+`. `^C` didn't seem to work to
> cancel this operation, although I pressed it pretty early in, after
> there were only a few rows of pasted text. I thought maybe just
> letting it go might be okay, and just used cpulimit to prevent it from
> hogging lots of CPU while I worked on something else. After a few
> minutes that vim process had consumed at least another couple of
> hundred megs of memory, at which point I killed it from another
> process. I was able to kill it with a normal kill signal (i.e. not
> `kill -9`), at which point it exited gracefully, notifying me that it
> had saved files (though not saved a session).
>
> Presumably this is a complicated issue which can't easily be
> rectified (unless it is fixed in vim 7.3?). Is there a workaround of
> some variety? Even just placing a fixed limit on the length of a
> command line entry, at a few hundred characters or so, would prevent
> these sort of catastrophes.
>
> Alternatively, perhaps there is a way to get vim to save a session
> file when it exits due to an interrupt signal? Not perfect, since
> there are a few items not saved in a session file, but for a quick fix
> it would be helpful.

There was a similar issue reported at vim_dev a couple of days ago. See
the thread that started at:
http://groups.google.com/group/vim_dev/msg/137352cc1adcdd16

This workaround was mentioned:
,----
| " Avoid command-line redraw on every entered character
| " by turning off Arabic
| " shaping (which is implemented poorly).
| if has('arabic')
| set noarabicshape
| endif
`----

regards,
Christian
--
Bei manchen Menschen geht alles schnell zum einen Ohr rein und zum
anderen raus - die haben auch nicht viel dazwischen.
-- Heinz Erhardt

--
You received this message from the "vim_use" 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

No comments: