aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/shada.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/shada.c')
-rw-r--r--src/nvim/shada.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 69e6d61464..7e7e7cfdf7 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -32,6 +32,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
+#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/search.h"
#include "nvim/regexp.h"
@@ -1274,7 +1275,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
if (cur_entry.data.search_pattern.is_last_used) {
set_last_used_pattern(
cur_entry.data.search_pattern.is_substitute_pattern);
- SET_NO_HLSEARCH(!cur_entry.data.search_pattern.highlighted);
+ set_no_hlsearch(!cur_entry.data.search_pattern.highlighted);
}
// Do not free shada entry: its allocated memory was saved above.
break;
@@ -2736,6 +2737,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
}
// Initialize jump list
+ setpcmark();
+ cleanup_jumplist(curwin, false);
wms->jumps_size = shada_init_jumps(wms->jumps, &removable_bufs);
// Initialize global marks
@@ -4085,11 +4088,13 @@ static bool shada_removable(const char *name)
static inline size_t shada_init_jumps(
PossiblyFreedShadaEntry *jumps, khash_t(bufset) *const removable_bufs)
{
- // Initialize jump list
+ if (!curwin->w_jumplistlen) {
+ return 0;
+ }
+
size_t jumps_size = 0;
const void *jump_iter = NULL;
- setpcmark();
- cleanup_jumplist(curwin, false);
+
do {
xfmark_T fm;
jump_iter = mark_jumplist_iter(jump_iter, curwin, &fm);
@@ -4163,6 +4168,7 @@ void shada_encode_jumps(msgpack_sbuffer *const sbuf)
khash_t(bufset) removable_bufs = KHASH_EMPTY_TABLE(bufset);
find_removable_bufs(&removable_bufs);
PossiblyFreedShadaEntry jumps[JUMPLISTSIZE];
+ cleanup_jumplist(curwin, true);
size_t jumps_size = shada_init_jumps(jumps, &removable_bufs);
msgpack_packer packer;
msgpack_packer_init(&packer, sbuf, msgpack_sbuffer_write);