diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 69 |
2 files changed, 76 insertions, 1 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index bd68ad6f97..6d4eb8ef49 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -2271,7 +2271,13 @@ void do_check_cursorbind(void) int restart_edit_save = restart_edit; restart_edit = true; check_cursor(); - validate_cursor(); + + // Avoid a scroll here for the cursor position, 'scrollbind' is + // more important. + if (!curwin->w_p_scb) { + validate_cursor(); + } + restart_edit = restart_edit_save; } // Correct cursor for multi-byte character. diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 007b7e0f14..e059ecb493 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1378,4 +1378,73 @@ func Test_diff_foldinvert() set scrollbind& endfunc +" This was scrolling for 'cursorbind' but 'scrollbind' is more important +func Test_diff_scroll() + CheckScreendump + + let left =<< trim END + line 1 + line 2 + line 3 + line 4 + + // Common block + // one + // containing + // four lines + + // Common block + // two + // containing + // four lines + END + call writefile(left, 'Xleft') + let right =<< trim END + line 1 + line 2 + line 3 + line 4 + + Lorem + ipsum + dolor + sit + amet, + consectetur + adipiscing + elit. + Etiam + luctus + lectus + sodales, + dictum + + // Common block + // one + // containing + // four lines + + Vestibulum + tincidunt + aliquet + nulla. + + // Common block + // two + // containing + // four lines + END + call writefile(right, 'Xright') + let buf = RunVimInTerminal('-d Xleft Xright', {'rows': 12}) + call term_sendkeys(buf, "\<C-W>\<C-W>jjjj") + call VerifyScreenDump(buf, 'Test_diff_scroll_1', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_diff_scroll_2', {}) + + call StopVimInTerminal(buf) + call delete('Xleft') + call delete('Xright') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |