diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-08-17 22:19:38 +0000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-08-19 01:40:40 -0400 |
commit | a40a7cf24f5a57963388cef5c5472ab4047d568f (patch) | |
tree | d6b413a4ffaf9f943a1963cd0e00637e62e45206 | |
parent | 8ae492bb5af3e1b086f8fa48946c07aa2660da59 (diff) | |
download | rneovim-a40a7cf24f5a57963388cef5c5472ab4047d568f.tar.gz rneovim-a40a7cf24f5a57963388cef5c5472ab4047d568f.tar.bz2 rneovim-a40a7cf24f5a57963388cef5c5472ab4047d568f.zip |
vim-patch:7.4.329 #1079
Problem: When moving the cursor and then switching to another window the
previous window isn't scrolled. (Yukihiro Nakadaira)
Solution: Call update_topline() before leaving the window. (Christian
Brabandt)
https://code.google.com/p/vim/source/detail?r=018df65085f8
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/version.c b/src/nvim/version.c index f2a85d5b69..246ce02f1f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -266,7 +266,7 @@ static int included_patches[] = { //332 NA 331, //330, - //329, + 329, 328, 327, //326 NA diff --git a/src/nvim/window.c b/src/nvim/window.c index ca56c9d5d5..755ecb0ef1 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3396,12 +3396,19 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid, int tri return; } - /* sync undo before leaving the current buffer */ - if (undo_sync && curbuf != wp->w_buffer) + // sync undo before leaving the current buffer + if (undo_sync && curbuf != wp->w_buffer) { u_sync(FALSE); - /* may have to copy the buffer options when 'cpo' contains 'S' */ - if (wp->w_buffer != curbuf) + } + + // Might need to scroll the old window before switching, e.g., when the + // cursor was moved. + update_topline(); + + // may have to copy the buffer options when 'cpo' contains 'S' + if (wp->w_buffer != curbuf) { buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP); + } if (!curwin_invalid) { prevwin = curwin; /* remember for CTRL-W p */ curwin->w_redr_status = TRUE; |