Skip to content

Commit cc23358

Browse files
committed
patch 8.2.2130: Insert mode completion messages end up in message history
Problem: Insert mode completion messages end up in message history. Solution: Set msg_hist_off. (closes #7452
1 parent 0ea7421 commit cc23358

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/insexpand.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ ins_compl_files(
12981298
fp = mch_fopen((char *)files[i], "r"); // open dictionary file
12991299
if (flags != DICT_EXACT)
13001300
{
1301+
msg_hist_off = TRUE; // reset in msg_trunc_attr()
13011302
vim_snprintf((char *)IObuff, IOSIZE,
13021303
_("Scanning dictionary: %s"), (char *)files[i]);
13031304
(void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
@@ -2778,6 +2779,7 @@ ins_compl_get_exp(pos_T *ini)
27782779
dict = ins_buf->b_fname;
27792780
dict_f = DICT_EXACT;
27802781
}
2782+
msg_hist_off = TRUE; // reset in msg_trunc_attr()
27812783
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
27822784
ins_buf->b_fname == NULL
27832785
? buf_spname(ins_buf)
@@ -2812,6 +2814,7 @@ ins_compl_get_exp(pos_T *ini)
28122814
#endif
28132815
else if (*e_cpt == ']' || *e_cpt == 't')
28142816
{
2817+
msg_hist_off = TRUE; // reset in msg_trunc_attr()
28152818
type = CTRL_X_TAGS;
28162819
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
28172820
(void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
@@ -3423,9 +3426,11 @@ ins_compl_next(
34233426
MB_PTR_ADV(s);
34243427
}
34253428
}
3429+
msg_hist_off = TRUE;
34263430
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
34273431
s > compl_shown_match->cp_fname ? "<" : "", s);
34283432
msg((char *)IObuff);
3433+
msg_hist_off = FALSE;
34293434
redraw_cmdline = FALSE; // don't overwrite!
34303435
}
34313436
}
@@ -4105,9 +4110,13 @@ ins_complete(int c, int enable_pum)
41054110
if (edit_submode_extra != NULL)
41064111
{
41074112
if (!p_smd)
4113+
{
4114+
msg_hist_off = TRUE;
41084115
msg_attr((char *)edit_submode_extra,
41094116
edit_submode_highl < HLF_COUNT
41104117
? HL_ATTR(edit_submode_highl) : 0);
4118+
msg_hist_off = FALSE;
4119+
}
41114120
}
41124121
else
41134122
msg_clr_cmdline(); // necessary for "noshowmode"

src/testdir/test_ins_complete.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func Test_omni_dash()
114114
set omnifunc=Omni
115115
new
116116
exe "normal Gofind -\<C-x>\<C-o>"
117-
call assert_equal("\n-\nmatch 1 of 2", execute(':2mess'))
117+
call assert_equal("find -help", getline('$'))
118118

119119
bwipe!
120120
delfunc Omni
@@ -714,4 +714,16 @@ func Test_issue_7021()
714714
set completeslash=
715715
endfunc
716716

717+
" Test to ensure 'Scanning...' messages are not recorded in messages history
718+
func Test_z1_complete_no_history()
719+
new
720+
messages clear
721+
let currmess = execute('messages')
722+
setlocal dictionary=README.txt
723+
exe "normal owh\<C-X>\<C-K>"
724+
exe "normal owh\<C-N>"
725+
call assert_equal(currmess, execute('messages'))
726+
close!
727+
endfunc
728+
717729
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2130,
753755
/**/
754756
2129,
755757
/**/

0 commit comments

Comments
 (0)