diff src/diff.c @ 14893:291656f731c9 v8.1.0458

patch 8.1.0458: ml_get error and crash when using "do" commit https://github.com/vim/vim/commit/df77cef92ec034796723ffa3adb12e8b46daa98e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 7 17:46:42 2018 +0200 patch 8.1.0458: ml_get error and crash when using "do" Problem: Ml_get error and crash when using "do". Solution: Adjust cursor position also when diffupdate is not needed. (Hirohito Higashi)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Oct 2018 18:00:05 +0200
parents 552523e44923
children 5d52b21b2e7f
line wrap: on
line diff
--- a/src/diff.c
+++ b/src/diff.c
@@ -2848,18 +2848,19 @@ ex_diffgetput(exarg_T *eap)
 theend:
     diff_busy = FALSE;
     if (diff_need_update)
-    {
+	ex_diffupdate(NULL);
+
+    // Check that the cursor is on a valid character and update it's
+    // position.  When there were filler lines the topline has become
+    // invalid.
+    check_cursor();
+    changed_line_abv_curs();
+
+    if (diff_need_update)
+	// redraw already done by ex_diffupdate()
 	diff_need_update = FALSE;
-	ex_diffupdate(NULL);
-    }
     else
     {
-	// Check that the cursor is on a valid character and update it's
-	// position.  When there were filler lines the topline has become
-	// invalid.
-	check_cursor();
-	changed_line_abv_curs();
-
 	// Also need to redraw the other buffers.
 	diff_redraw(FALSE);
 	apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);