diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-24 02:51:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 02:51:07 +0200 |
commit | ad60927d09252d457fe454921216d42c9068c20b (patch) | |
tree | 71d549f440b994d4507e4f8423561c0a85e9457a /src/nvim/getchar.c | |
parent | ffb89049131a1e381c7d2b313acb953009bae067 (diff) | |
parent | 77cb14cc6da5dff685c6e5a4005da433c39d5ff7 (diff) | |
download | rneovim-ad60927d09252d457fe454921216d42c9068c20b.tar.gz rneovim-ad60927d09252d457fe454921216d42c9068c20b.tar.bz2 rneovim-ad60927d09252d457fe454921216d42c9068c20b.zip |
Merge #8304 "default to 'nofsync'"
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 98164b2653..e2566c8c66 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1328,10 +1328,8 @@ int using_script(void) return scriptin[curscript] != NULL; } -/* - * This function is called just before doing a blocking wait. Thus after - * waiting 'updatetime' for a character to arrive. - */ +/// This function is called just before doing a blocking wait. Thus after +/// waiting 'updatetime' for a character to arrive. void before_blocking(void) { updatescript(0); @@ -1340,21 +1338,22 @@ void before_blocking(void) } } -/* - * updatescipt() is called when a character can be written into the script file - * or when we have waited some time for a character (c == 0) - * - * All the changed memfiles are synced if c == 0 or when the number of typed - * characters reaches 'updatecount' and 'updatecount' is non-zero. - */ -void updatescript(int c) +/// updatescript() is called when a character can be written to the script file +/// or when we have waited some time for a character (c == 0). +/// +/// All the changed memfiles are synced if c == 0 or when the number of typed +/// characters reaches 'updatecount' and 'updatecount' is non-zero. +static void updatescript(int c) { static int count = 0; - if (c && scriptout) + if (c && scriptout) { putc(c, scriptout); - if (c == 0 || (p_uc > 0 && ++count >= p_uc)) { - ml_sync_all(c == 0, TRUE); + } + bool idle = (c == 0); + if (idle || (p_uc > 0 && ++count >= p_uc)) { + ml_sync_all(idle, true, + (!!p_fs || idle)); // Always fsync at idle (CursorHold). count = 0; } } |