]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2130: Insert mode completion messages end up in message history v8.2.2130
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Dec 2020 12:32:07 +0000 (13:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Dec 2020 12:32:07 +0000 (13:32 +0100)
Problem:    Insert mode completion messages end up in message history.
Solution:   Set msg_hist_off. (closes #7452

src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index eebf01dc474154f63b3e061901d4fff3d0ce7d5f..28017d4366fd2250de79992d5b15d5047acb9039 100644 (file)
@@ -1298,6 +1298,7 @@ ins_compl_files(
        fp = mch_fopen((char *)files[i], "r");  // open dictionary file
        if (flags != DICT_EXACT)
        {
+           msg_hist_off = TRUE;        // reset in msg_trunc_attr()
            vim_snprintf((char *)IObuff, IOSIZE,
                              _("Scanning dictionary: %s"), (char *)files[i]);
            (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
@@ -2778,6 +2779,7 @@ ins_compl_get_exp(pos_T *ini)
                    dict = ins_buf->b_fname;
                    dict_f = DICT_EXACT;
                }
+               msg_hist_off = TRUE;    // reset in msg_trunc_attr()
                vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
                        ins_buf->b_fname == NULL
                            ? buf_spname(ins_buf)
@@ -2812,6 +2814,7 @@ ins_compl_get_exp(pos_T *ini)
 #endif
                else if (*e_cpt == ']' || *e_cpt == 't')
                {
+                   msg_hist_off = TRUE;        // reset in msg_trunc_attr()
                    type = CTRL_X_TAGS;
                    vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
                    (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
@@ -3423,9 +3426,11 @@ ins_compl_next(
                    MB_PTR_ADV(s);
                }
            }
+           msg_hist_off = TRUE;
            vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
                                s > compl_shown_match->cp_fname ? "<" : "", s);
            msg((char *)IObuff);
+           msg_hist_off = FALSE;
            redraw_cmdline = FALSE;         // don't overwrite!
        }
     }
@@ -4105,9 +4110,13 @@ ins_complete(int c, int enable_pum)
            if (edit_submode_extra != NULL)
            {
                if (!p_smd)
+               {
+                   msg_hist_off = TRUE;
                    msg_attr((char *)edit_submode_extra,
                            edit_submode_highl < HLF_COUNT
                            ? HL_ATTR(edit_submode_highl) : 0);
+                   msg_hist_off = FALSE;
+               }
            }
            else
                msg_clr_cmdline();      // necessary for "noshowmode"
index 5e2bebbf54f0b68e67e974441faca7b28a680c00..b1a2a9e307ec54b34e79c5c97bf7b2c9c8af74f1 100644 (file)
@@ -114,7 +114,7 @@ func Test_omni_dash()
   set omnifunc=Omni
   new
   exe "normal Gofind -\<C-x>\<C-o>"
-  call assert_equal("\n-\nmatch 1 of 2", execute(':2mess'))
+  call assert_equal("find -help", getline('$'))
 
   bwipe!
   delfunc Omni
@@ -714,4 +714,16 @@ func Test_issue_7021()
   set completeslash=
 endfunc
 
+" Test to ensure 'Scanning...' messages are not recorded in messages history
+func Test_z1_complete_no_history()
+  new
+  messages clear
+  let currmess = execute('messages')
+  setlocal dictionary=README.txt
+  exe "normal owh\<C-X>\<C-K>"
+  exe "normal owh\<C-N>"
+  call assert_equal(currmess, execute('messages'))
+  close!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 9dae296a1e8362ada732a05cd3ae309e00de1ede..65b2857b047012f18e6601cb91432782cda36034 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2130,
 /**/
     2129,
 /**/