aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-04-21 00:34:13 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-04-21 12:51:27 +0200
commit498731615c2f879c0b67323aba385c17a4a39d24 (patch)
tree0f0fbfa0a794b089718dd9c783fa7ea697639037 /src/nvim/getchar.c
parenta02d22cca825f2c04381b40d50abfc7a15afec20 (diff)
downloadrneovim-498731615c2f879c0b67323aba385c17a4a39d24.tar.gz
rneovim-498731615c2f879c0b67323aba385c17a4a39d24.tar.bz2
rneovim-498731615c2f879c0b67323aba385c17a4a39d24.zip
IO: let 'fsync' option control more cases
Vim has the 'swapsync' option which we removed in 62d137ce0969. Instead let 'fsync' control swapfile-fsync. These cases ALWAYS force fsync (ignoring 'fsync' option): - Idle (CursorHold). - Exit caused by deadly signal. - SIGPWR signal. - Explicit :preserve command.
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 98164b2653..3541ba7cc8 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1347,14 +1347,17 @@ void before_blocking(void)
* 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)
+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;
}
}