Hi Praful! On Do, 29 Mai 2014, Praful Kapadia wrote:
> I have had an annoying issue with gvim 7.4, with patches 1-307. If I open a > large file (e.g. containing 200,000 lines) and use the global command to > delete lines, the operation takes a very long time on Windows if clipboard > has been set to unnamed. I'm assuming it's the constant copying of deleted > lines to the Windows clipboard that's slowing gvim down. > > I use Windows 7 64-bit. I have compiled gvim 64-bit using ming. The issue > occurs on gvim 64-bit, 32-bit and, to a lesser extent, on MacVim. > > On Windows, it takes several minutes to carry out the operation. During this > time, Windows becomes unusable, which is poor but that's another issue. > > On OS X, in MacVim, the same operation takes 30 seconds. With clipboard="", > it takes two seconds. > > Here are the steps to reproduce the issue: > > 1. Open gvim with no plugins and no vimrc. > 2. :set clipboard=unnamed > 3. Open a text file with about 200,000 lines. > 4. Enter :g/string/d The "string" should match about 150,000 lines i.e. > you want to delete lots of rows! > 5. Go for a coffee break (Windows!) or wait 30 seconds (OS X) > > In practice, if I issue the command on Windows, I kill the process then open > the file again, this time setting clipboard="" before I issue the command. > > The workaround (:set clipboard="") is fine if you remember it! It would be > nice if gvim did this e.g. (pseudo-code): > > old_clipboard = clipboard > try > clipboard = "" > execute global command > finally > clipboard = old_clipboard > end > > One consideration for side effects: currently, if clipboard=unnamed, the only > text that ends up on the system clipboard is the final deleted line, not all > deleted lines. If anything, you might want all deleted text to be on the > clipboard but that is not what currently happens. I suspect neither the last > line nor all lines is generally required. I don't care (others might) what > ends up on the clipboard and would be happy if there was no speed penalty > when the command was issued! > > It would be great if someone could look at this! This is a known issue for windows (see :h todo.txt and search for :g/test/d) Here is an experimental patch, that resets the clipboard option for :g command, when there are many matches (>100). Note: I haven't tested it. Best, Christian -- -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1502,6 +1502,8 @@ A jump table for the options with a shor or not. The clipboard register can always be explicitly accessed using the "* notation. Also see |gui-clipboard|. + (Note: will be reset for |:g| commands when there + are many matches to prevent hanging system) *clipboard-unnamedplus* unnamedplus A variant of the "unnamed" flag which uses the @@ -1516,6 +1518,9 @@ A jump table for the options with a shor Availability can be checked with: > if has('unnamedplus') < + (Note: will be reset for |:g| commands when there + are many matches to prevent hanging system) + *clipboard-autoselect* autoselect Works like the 'a' flag in 'guioptions': If present, then whenever Visual mode is started, or the Visual diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5421,6 +5421,9 @@ ex_global(eap) regmmatch_T regmatch; int match; int which_pat; +#ifdef FEAT_CLIPBOARD + int save_clip_unnamed = clip_unnamed; +#endif if (global_busy) { @@ -5511,10 +5514,20 @@ ex_global(eap) smsg((char_u *)_("Pattern not found: %s"), pat); } else + { +#ifdef FEAT_CLIPBOARD + if (ndone > 100) + /* reset clipboard for more then 100 matches (prevents hanging Windows) */ + clip_unnamed = 0; +#endif global_exe(cmd); + } ml_clearmarked(); /* clear rest of the marks */ vim_regfree(regmatch.regprog); +#ifdef FEAT_CLIPBOARD + clip_unnamed = save_clip_unnamed; +#endif } /*