diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-03-08 12:23:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 12:23:53 +0100 |
commit | 0355c1ed9c481d4ad3bf24887e0af869834e1b40 (patch) | |
tree | 514a6d13225e96d17dbc36f0a8d8c1991acacc3c /src/nvim/eval.c | |
parent | 5f84b1dc4154ea8def87b6113fa9b9ed058d83d2 (diff) | |
parent | e3d9945f7fd773b69844460153d8481790ff1f30 (diff) | |
download | rneovim-0355c1ed9c481d4ad3bf24887e0af869834e1b40.tar.gz rneovim-0355c1ed9c481d4ad3bf24887e0af869834e1b40.tar.bz2 rneovim-0355c1ed9c481d4ad3bf24887e0af869834e1b40.zip |
Merge #9695 'vim-patch:8.1.{739,826,998}'
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d18884ff07..7b6990e077 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10086,10 +10086,23 @@ static void getpos_both(typval_T *argvars, typval_T *rettv, bool getcurpos) tv_list_append_number( l, (fp != NULL) ? (varnumber_T)fp->coladd : (varnumber_T)0); if (getcurpos) { + const int save_set_curswant = curwin->w_set_curswant; + const colnr_T save_curswant = curwin->w_curswant; + const colnr_T save_virtcol = curwin->w_virtcol; + update_curswant(); tv_list_append_number(l, (curwin->w_curswant == MAXCOL ? (varnumber_T)MAXCOL : (varnumber_T)curwin->w_curswant + 1)); + + // Do not change "curswant", as it is unexpected that a get + // function has a side effect. + if (save_set_curswant) { + curwin->w_set_curswant = save_set_curswant; + curwin->w_curswant = save_curswant; + curwin->w_virtcol = save_virtcol; + curwin->w_valid &= ~VALID_VIRTCOL; + } } } |