vim-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 vim/vim#5419)
efcc329020
This commit is contained in:
Jan Edmund Lazo
2021-02-13 18:17:57 -05:00
parent 54cd7298f8
commit e87c30a196
2 changed files with 48 additions and 29 deletions

View File

@@ -2309,6 +2309,10 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
*num_file = 0; // return values in case of FAIL
*file = NULL;
if ((options & BUF_DIFF_FILTER) && !curwin->w_p_diff) {
return FAIL;
}
// Make a copy of "pat" and change "^" to "\(^\|[\/]\)".
if (*pat == '^') {
patc = xmalloc(STRLEN(pat) + 11);
@@ -2348,9 +2352,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
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;
}
}