From 5c87d40acdd02286baf492067031c93d93b7d389 Mon Sep 17 00:00:00 2001 From: Michael Ennen Date: Wed, 30 Dec 2015 23:42:38 -0700 Subject: vim patches 7.4.955/974/975/989. #3919 Helped by @Shougo. vim-patch:7.4.955 vim-patch:7.4.974 vim-patch:7.4.975 vim-patch:7.4.989 Port upstream vim patches 955, 974, 975 and 989. Mark patches 964, 968, 970, and 971, and 982 as NA. Update patch list to 1022. patch 7.4.955 Problem: Vim doesn't recognize .pl6 and .pod6 files. Solution: Recognize them as perl6 and pod6. (Mike Eve) patch 7.4.974 Problem: When using :diffsplit the cursor jumps to the first line. Solution: Put the cursor on the line related to where the cursor was before the split. patch 7.4.975 Problem: Using ":sort" on a very big file sometimes causes text to be corrupted. (John Beckett) Solution: Copy the line into a buffer before calling ml_append(). patch 7.4.989 Problem: Leaking memory when hash_add() fails. Coverity error 99126. Solution: When hash_add() fails free the memory. 778 marked as not NA as it will be needed once vim patch 754 is merged Marked as NA: 964 test 87 was deleted 968 tests 86/87 were deleted 970 guarded by: `# if defined(FEAT_GUI_GTK) || defined(PROTO` and is inside a function that no longer exists 971 function table already sorted correctly 982 marked as NA because Neovim tests are only specified in exactly one location --- src/nvim/diff.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index d311588ab4..ce79158050 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1007,6 +1007,7 @@ theend: void ex_diffsplit(exarg_T *eap) { win_T *old_curwin = curwin; + buf_T *old_curbuf = curbuf; // don't use a new tab page, each tab page has its own diffs cmdmod.tab = 0; @@ -1020,8 +1021,19 @@ void ex_diffsplit(exarg_T *eap) // split must have worked if (curwin != old_curwin) { // Set 'diff', 'scrollbind' on and 'wrap' off. - diff_win_options(curwin, TRUE); - diff_win_options(old_curwin, TRUE); + diff_win_options(curwin, true); + if (win_valid(old_curwin)) { + diff_win_options(old_curwin, true); + + if (buf_valid(old_curbuf)) { + // Move the cursor position to that of the old window. + curwin->w_cursor.lnum = diff_get_corresponding_line( + old_curbuf, + old_curwin->w_cursor.lnum, + curbuf, + curwin->w_cursor.lnum); + } + } } } } -- cgit