diff options
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index a2c4435014..1cd95f2ed9 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2177,6 +2177,7 @@ int do_ecmd( int did_get_winopts = FALSE; int readfile_flags = 0; bool did_inc_redrawing_disabled = false; + long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; if (eap != NULL) command = eap->do_ecmd_cmd; @@ -2678,13 +2679,14 @@ int do_ecmd( RedrawingDisabled--; did_inc_redrawing_disabled = false; if (!skip_redraw) { - n = p_so; - if (topline == 0 && command == NULL) - p_so = 999; // force cursor to be vertically centered in the window + n = *so_ptr; + if (topline == 0 && command == NULL) { + *so_ptr = 999; // force cursor to be vertically centered in the window + } update_topline(); curwin->w_scbind_pos = curwin->w_topline; - p_so = n; - redraw_curbuf_later(NOT_VALID); /* redraw this buffer later */ + *so_ptr = n; + redraw_curbuf_later(NOT_VALID); // redraw this buffer later } if (p_im) |