diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/globals.h | 4 | ||||
-rw-r--r-- | src/nvim/memfile.c | 5 | ||||
-rw-r--r-- | src/nvim/memline.c | 7 |
3 files changed, 4 insertions, 12 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 3c705d88a5..c41b54e22e 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -588,10 +588,6 @@ EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer #define FOR_ALL_BUFFERS_BACKWARDS(buf) \ for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev) -/* Flag that is set when switching off 'swapfile'. It means that all blocks - * are to be loaded into memory. Shouldn't be global... */ -EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */ - /* * List of files being edited (global argument list). curwin->w_alist points * to this when the window is using the global argument list. diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 7f40c5b10e..da5068d45c 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -195,12 +195,9 @@ void mf_close_file(buf_T *buf, bool getlines) if (getlines) { // get all blocks in memory by accessing all lines (clumsy!) - mf_dont_release = true; - for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) { + for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; lnum++) { (void)ml_get_buf(buf, lnum, false); } - mf_dont_release = false; - // TODO(elmart): should check if all blocks are really in core } if (close(mfp->mf_fd) < 0) { // close the file diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 5ea2397db3..87ca5181d2 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1759,7 +1759,7 @@ errorret: * Don't use the last used line when 'swapfile' is reset, need to load all * blocks. */ - if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release) { + if (buf->b_ml.ml_line_lnum != lnum) { ml_flush_line(buf); /* @@ -2760,9 +2760,8 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action) if (buf->b_ml.ml_locked) { if (ML_SIMPLE(action) && buf->b_ml.ml_locked_low <= lnum - && buf->b_ml.ml_locked_high >= lnum - && !mf_dont_release) { - /* remember to update pointer blocks and stack later */ + && buf->b_ml.ml_locked_high >= lnum) { + // remember to update pointer blocks and stack later if (action == ML_INSERT) { ++(buf->b_ml.ml_locked_lineadd); ++(buf->b_ml.ml_locked_high); |