Skip to content

Commit

Permalink
Merge pull request #5913 from mhinz/buf-lookup-patches
Browse files Browse the repository at this point in the history
vim-patch:7.4.2017,7.4.2018,7.4.2021,7.4.2022,7.4.2023,7.4.2024
  • Loading branch information
jamessan committed Feb 6, 2017
2 parents a767fee + b0cf071 commit 11efbc8
Show file tree
Hide file tree
Showing 21 changed files with 471 additions and 301 deletions.
12 changes: 6 additions & 6 deletions src/nvim/api/buffer.c
Expand Up @@ -290,7 +290,6 @@ void nvim_buf_set_lines(uint64_t channel_id,
return;
}

buf_T *save_curbuf = NULL;
win_T *save_curwin = NULL;
tabpage_T *save_curtab = NULL;
size_t new_len = replacement.size;
Expand Down Expand Up @@ -322,6 +321,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
}

try_start();
bufref_T save_curbuf = { NULL, 0 };
switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf);

if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) {
Expand Down Expand Up @@ -389,7 +389,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
// changed range, and move any in the remainder of the buffer.
// Only adjust marks if we managed to switch to a window that holds
// the buffer, otherwise line numbers will be invalid.
if (save_curbuf == NULL) {
if (save_curbuf.br_buf == NULL) {
mark_adjust((linenr_T)start, (linenr_T)(end - 1), MAXLNUM, extra);
}

Expand All @@ -405,7 +405,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
}

xfree(lines);
restore_win_for_buf(save_curwin, save_curtab, save_curbuf);
restore_win_for_buf(save_curwin, save_curtab, &save_curbuf);
try_end(err);
}

Expand Down Expand Up @@ -651,13 +651,13 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
}

pos_T *posp;
buf_T *savebuf;
char mark = *name.data;

try_start();
switch_buffer(&savebuf, buf);
bufref_T save_buf;
switch_buffer(&save_buf, buf);
posp = getmark(mark, false);
restore_buffer(savebuf);
restore_buffer(&save_buf);

if (try_end(err)) {
return rv;
Expand Down
4 changes: 2 additions & 2 deletions src/nvim/api/private/helpers.c
Expand Up @@ -899,7 +899,7 @@ static void set_option_value_for(char *key,
{
win_T *save_curwin = NULL;
tabpage_T *save_curtab = NULL;
buf_T *save_curbuf = NULL;
bufref_T save_curbuf = { NULL, 0 };

try_start();
switch (opt_type)
Expand All @@ -922,7 +922,7 @@ static void set_option_value_for(char *key,
case SREQ_BUF:
switch_buffer(&save_curbuf, (buf_T *)from);
set_option_value_err(key, numval, stringval, opt_flags, err);
restore_buffer(save_curbuf);
restore_buffer(&save_curbuf);
break;
case SREQ_GLOBAL:
set_option_value_err(key, numval, stringval, opt_flags, err);
Expand Down

0 comments on commit 11efbc8

Please sign in to comment.