diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-06 09:00:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-06 09:00:24 -0400 |
commit | 71107e12c7b68d8faf1bcc1a5794a55b21e146f3 (patch) | |
tree | 57623fc268dbf5d2a919f04aa3d66c78bff78cb4 /src/nvim/ex_session.c | |
parent | 8a93d1028f38c77d7ad8b4ad0a93dc11a5cbe85d (diff) | |
parent | 296711cfad7bb8d80f2e2c363b3708764156444f (diff) | |
download | rneovim-71107e12c7b68d8faf1bcc1a5794a55b21e146f3.tar.gz rneovim-71107e12c7b68d8faf1bcc1a5794a55b21e146f3.tar.bz2 rneovim-71107e12c7b68d8faf1bcc1a5794a55b21e146f3.zip |
Merge pull request #14499 from janlazo/vim-8.2.2819
vim-patch:8.0.1309,8.2.{1166,2819,2820,2825,2827,2828,2829,2832,2833}
Diffstat (limited to 'src/nvim/ex_session.c')
-rw-r--r-- | src/nvim/ex_session.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index b11ec4ad05..9e4e69e124 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -447,18 +447,25 @@ static int put_view( if (do_cursor) { // Restore the cursor line in the file and relatively in the // window. Don't use "G", it changes the jumplist. + if (wp->w_height_inner <= 0) { + if (fprintf(fd, "let s:l = %" PRIdLINENR "\n", wp->w_cursor.lnum) < 0) { + return FAIL; + } + } else if (fprintf(fd, + "let s:l = %" PRIdLINENR " - ((%" PRIdLINENR + " * winheight(0) + %" PRId64 ") / %" PRId64 ")\n", + wp->w_cursor.lnum, + wp->w_cursor.lnum - wp->w_topline, + (int64_t)(wp->w_height_inner / 2), + (int64_t)wp->w_height_inner) < 0) { + return FAIL; + } if (fprintf(fd, - "let s:l = %" PRId64 " - ((%" PRId64 - " * winheight(0) + %" PRId64 ") / %" PRId64 ")\n" "if s:l < 1 | let s:l = 1 | endif\n" "keepjumps exe s:l\n" "normal! zt\n" - "keepjumps %" PRId64 "\n", - (int64_t)wp->w_cursor.lnum, - (int64_t)(wp->w_cursor.lnum - wp->w_topline), - (int64_t)(wp->w_height_inner / 2), - (int64_t)wp->w_height_inner, - (int64_t)wp->w_cursor.lnum) < 0) { + "keepjumps %" PRIdLINENR "\n", + wp->w_cursor.lnum) < 0) { return FAIL; } // Restore the cursor column and left offset when not wrapping. |