diff src/buffer.c @ 19007:0883a37ccf84 v8.2.0064

patch 8.2.0064: diffmode completion doesn't use per-window setting Commit: https://github.com/vim/vim/commit/efcc329020ef089267f5f3994b8544eb58806311 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 30 21:59:03 2019 +0100 patch 8.2.0064: diffmode completion doesn't use per-window setting Problem: Diffmode completion doesn't use per-window setting. Solution: Check if a window is in diff mode. (Dominique Pell, closes https://github.com/vim/vim/issues/5419)
author Bram Moolenaar <Bram@vim.org>
date Mon, 30 Dec 2019 22:00:04 +0100
parents 847cc7932c42
children af795b6a2624
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2661,6 +2661,11 @@ ExpandBufnames(
     *num_file = 0;		    // return values in case of FAIL
     *file = NULL;
 
+#ifdef FEAT_DIFF
+    if ((options & BUF_DIFF_FILTER) && !curwin->w_p_diff)
+	return FAIL;
+#endif
+
     // Make a copy of "pat" and change "^" to "\(^\|[\/]\)".
     if (*pat == '^')
     {
@@ -2706,8 +2711,7 @@ ExpandBufnames(
 		if (options & BUF_DIFF_FILTER)
 		    // Skip buffers not suitable for
 		    // :diffget or :diffput completion.
-		    if (buf == curbuf
-			    || !diff_mode_buf(curbuf) || !diff_mode_buf(buf))
+		    if (buf == curbuf || !diff_mode_buf(buf))
 			continue;
 #endif