diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-09-05 09:24:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-05 09:24:36 +0200 |
commit | 73849ceeb977c855af484b8bcb772b71e293768e (patch) | |
tree | 4fe5f17a645b9420c03cd01387218997ab906386 /src/nvim/ex_docmd.c | |
parent | 30b70de39ea00762498582871f9539b4c0612d7f (diff) | |
parent | 3e1daa84e91c1e94301419bf1297b4cd88c6498f (diff) | |
download | rneovim-73849ceeb977c855af484b8bcb772b71e293768e.tar.gz rneovim-73849ceeb977c855af484b8bcb772b71e293768e.tar.bz2 rneovim-73849ceeb977c855af484b8bcb772b71e293768e.zip |
Merge #8948 from janlazo/vim-8.1.0331
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 5a92a85c97..abefca231c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9239,6 +9239,18 @@ static int ses_do_win(win_T *wp) return true; } +static int put_view_curpos(FILE *fd, const win_T *wp, char *spaces) +{ + int r; + + if (wp->w_curswant == MAXCOL) { + r = fprintf(fd, "%snormal! $", spaces); + } else { + r = fprintf(fd, "%snormal! 0%d|", spaces, wp->w_virtcol + 1); + } + return r < 0 || put_eol(fd) == FAIL ? FAIL : OK; +} + /* * Write commands to "fd" to restore the view of a window. * Caller must make sure 'scrolloff' is zero. @@ -9405,14 +9417,11 @@ put_view( (int64_t)(wp->w_virtcol + 1)) < 0 || put_eol(fd) == FAIL || put_line(fd, "else") == FAIL - || fprintf(fd, " normal! 0%d|", wp->w_virtcol + 1) < 0 - || put_eol(fd) == FAIL + || put_view_curpos(fd, wp, " ") == FAIL || put_line(fd, "endif") == FAIL) return FAIL; - } else { - if (fprintf(fd, "normal! 0%d|", wp->w_virtcol + 1) < 0 - || put_eol(fd) == FAIL) - return FAIL; + } else if (put_view_curpos(fd, wp, "") == FAIL) { + return FAIL; } } } |