diff options
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index ab8072ae1d..a542bb19dd 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -15,6 +15,7 @@ #include "nvim/ascii.h" #include "nvim/fileio.h" #include "nvim/buffer.h" +#include "nvim/buffer_updates.h" #include "nvim/change.h" #include "nvim/charset.h" #include "nvim/cursor.h" @@ -1651,9 +1652,6 @@ failed: # ifdef HAVE_ICONV if (iconv_fd != (iconv_t)-1) { iconv_close(iconv_fd); -# ifndef __clang_analyzer__ - iconv_fd = (iconv_t)-1; -# endif } # endif @@ -2031,7 +2029,7 @@ static char_u *next_fenc(char_u **pp, bool *alloced) r = enc_canonize(*pp); *pp += STRLEN(*pp); } else { - r = vim_strnsave(*pp, (int)(p - *pp)); + r = vim_strnsave(*pp, p - *pp); *pp = p + 1; p = enc_canonize(r); xfree(r); @@ -4216,7 +4214,9 @@ void shorten_buf_fname(buf_T *buf, char_u *dirname, int force) && (force || buf->b_sfname == NULL || path_is_absolute(buf->b_sfname))) { - XFREE_CLEAR(buf->b_sfname); + if (buf->b_sfname != buf->b_ffname) { + XFREE_CLEAR(buf->b_sfname); + } p = path_shorten_fname(buf->b_ffname, dirname); if (p != NULL) { buf->b_sfname = vim_strsave(p); @@ -4672,7 +4672,6 @@ check_timestamps( ) { int didit = 0; - int n; /* Don't check timestamps while system() or another low-level function may * cause us to lose and gain focus. */ @@ -4700,7 +4699,7 @@ check_timestamps( if (buf->b_nwindows > 0) { bufref_T bufref; set_bufref(&bufref, buf); - n = buf_check_timestamp(buf, focus); + const int n = buf_check_timestamp(buf); if (didit < n) { didit = n; } @@ -4770,11 +4769,7 @@ static int move_lines(buf_T *frombuf, buf_T *tobuf) * return 2 if a message has been displayed. * return 0 otherwise. */ -int -buf_check_timestamp( - buf_T *buf, - int focus /* called for GUI focus event */ -) +int buf_check_timestamp(buf_T *buf) FUNC_ATTR_NONNULL_ALL { int retval = 0; @@ -5082,6 +5077,7 @@ void buf_reload(buf_T *buf, int orig_mode) // Mark all undo states as changed. u_unchanged(curbuf); } + buf_updates_unregister_all(curbuf); } } xfree(ea.cmd); @@ -5101,8 +5097,8 @@ void buf_reload(buf_T *buf, int orig_mode) curwin->w_topline = old_topline; curwin->w_cursor = old_cursor; check_cursor(); - update_topline(); - keep_filetype = FALSE; + update_topline(curwin); + keep_filetype = false; /* Update folds unless they are defined manually. */ FOR_ALL_TAB_WINDOWS(tp, wp) { |