]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1634: message is cleared when removing mode message v9.0.1634
authorBram Moolenaar <Bram@vim.org>
Thu, 15 Jun 2023 15:40:02 +0000 (16:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 15 Jun 2023 15:40:02 +0000 (16:40 +0100)
Problem:    Message is cleared when removing mode message (Gary Johnson).
Solution:   Do not clear the command line after displaying a message.

src/message.c
src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump [new file with mode: 0644]
src/testdir/test_messages.vim
src/version.c

index 985161d2e818c3590eed6337c0e42684f7b80862..44c4f8557450756ebeb7f52445631a7771dd476a 100644 (file)
@@ -1641,6 +1641,14 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
        attr &= ~MSG_HIST;
     }
 
+    // When drawing over the command line no need to clear it later or remove
+    // the mode message.
+    if (msg_row == cmdline_row && msg_col == 0)
+    {
+       clear_cmdline = FALSE;
+       mode_displayed = FALSE;
+    }
+
     // If the string starts with a composing character first draw a space on
     // which the composing char can be drawn.
     if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr)))
diff --git a/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump b/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump
new file mode 100644 (file)
index 0000000..9e8d20a
--- /dev/null
@@ -0,0 +1,10 @@
+>o+0&#ffffff0|n|e| @71
+|t|w|o| @71
+|t|h|r|e@1| @69
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|f+0#0000000&|r|o|m| |D|e|b|u|g|S|i|l|e|n|t| |n|o|r|m|a|l| @33|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump b/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump
new file mode 100644 (file)
index 0000000..49dabef
--- /dev/null
@@ -0,0 +1,10 @@
+>o+0&#ffffff0|n|e| @71
+|t|w|o| @71
+|t|h|r|e@1| @69
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|f+0#0000000&|r|o|m| |D|e|b|u|g|S|i|l|e|n|t| |v|i|s|u|a|l| @33|1|,|1| @10|A|l@1| 
index ff705fe85f94f37cbe09c55f3a63c6c12815802d..0647afd287c07703239076aaa63f57a73e9ff1b8 100644 (file)
@@ -336,6 +336,34 @@ func Test_message_more_scrollback()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_message_not_cleared_after_mode()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      nmap <silent> gx :call DebugSilent('normal')<CR>
+      vmap <silent> gx :call DebugSilent('visual')<CR>
+      function DebugSilent(arg)
+          echomsg "from DebugSilent" a:arg
+      endfunction
+      set showmode
+      set cmdheight=1
+      call setline(1, ['one', 'two', 'three'])
+  END
+  call writefile(lines, 'XmessageMode', 'D')
+  let buf = RunVimInTerminal('-S XmessageMode', {'rows': 10})
+
+  call term_sendkeys(buf, 'gx')
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_1', {})
+
+  " removing the mode message used to also clear the intended message
+  call term_sendkeys(buf, 'vEgx')
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_2', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " Test verbose message before echo command
 func Test_echo_verbose_system()
   CheckRunVimInTerminal
index 7a1c730263d115a8f957b91e1c36977422d630c8..8f382e16f496fb3aa36e25c5cc3030c6e04a4676 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1634,
 /**/
     1633,
 /**/