Hi,

I noticed that in sessions with many (100+) small buffers, keyword completion 
over a slow network causes a 2+ second hiccup.  I think this is because during 
keyword completion, Vim prints the line "Scanning %s" for each open buffer into 
the command line.  When buffers are small (and therefore keyword scanning is 
very fast), these screen updates happen very quickly one after another and 
create a spike in network traffic which causes the underlying SSH session to be 
unresponsive until all screen updates are accounted for.

I wonder if instead of printing "Scanning %s" for each buffer in the session 
during keyword completion, Vim could instead print say "Scanning buffers." just 
once.  This would reduce the amount of screen updates performed during keyword 
completion, thereby making keyword completion more responsive under slow 
terminals/networks.

Here's a candidate patch that implements the above suggestion.

diff -r 53bfbc9e797d src/edit.c
--- a/src/edit.c        Tue Jan 14 16:55:01 2014 +0100
+++ b/src/edit.c        Tue Jan 14 12:21:31 2014 -0500
@@ -4180,6 +4180,7 @@
     char_u     *dict = NULL;
     int                dict_f = 0;
     compl_T    *old_match;
+    int                began_scanning_buffers = FALSE;

     if (!compl_started)
     {
@@ -4239,13 +4240,12 @@
                    dict = ins_buf->b_fname;
                    dict_f = DICT_EXACT;
                }
-               vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
-                       ins_buf->b_fname == NULL
-                           ? buf_spname(ins_buf)
-                           : ins_buf->b_sfname == NULL
-                               ? ins_buf->b_fname
-                               : ins_buf->b_sfname);
-               (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
+               if (!began_scanning_buffers)
+               {
+                   vim_snprintf((char *)IObuff, IOSIZE, _("Scanning 
buffers."));
+                   (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
+                   began_scanning_buffers = TRUE;
+               }
            }
            else if (*e_cpt == NUL)
                break;

-- 
-- 
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/groups/opt_out.

Raspunde prin e-mail lui