os/shell: Throttle :! output, pulse "..." message.

Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly
improves responsiveness when :! spams MB or GB of output:
    :!yes
    :!while true; do date; done
    :!git grep ''
    :grep -r '' *

After ~10KB of data is seen from a single :! invocation, output will be skipped
for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the
behavior alternates at every:
    * 10KB received
    * ~1s throttled

This also avoids out-of-memory which could happen with large :! outputs.

Note: This commit does not change the behavior of execute(':!foo').
      execute(':!foo') returns the string ':!foo^M', it captures *only* Vim
      messages, *not* shell command output. Vim behaves the same way.
      Use system('foo') for capturing shell command output.

Closes #1234

Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
Justin M. Keyes
2016-09-30 02:33:50 +02:00
parent 043f85210a
commit 97204e1cef
8 changed files with 158 additions and 25 deletions

View File

@@ -534,7 +534,7 @@ int main(int argc, char **argv)
}
TIME_MSG("before starting main loop");
ILOG("Starting Neovim main loop.");
ILOG("starting main loop");
/*
* Call the main command loop. This never returns.