neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 276860b5380de8f0a7abf0ad58e70ef0f59f32c4
parent 18e8839c804e97d6a64ed5e7cfa440e95f34ff35
Author: luukvbaal <luukvbaal@gmail.com>
Date:   Thu, 24 Apr 2025 21:11:49 +0200

fix(messages): clear 'showmode' message after insert_expand #33607

Problem:  'showmode' ext_messages state is not cleared after insert_expand mode.
Solution: Replace empty message with more idiomatic way to clear the showmode.
Diffstat:
Msrc/nvim/edit.c | 2+-
Mtest/functional/treesitter/highlight_spec.lua | 4++--
Mtest/functional/ui/messages_spec.lua | 16++++++++++++++++
3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/nvim/edit.c b/src/nvim/edit.c @@ -3458,7 +3458,7 @@ static bool ins_esc(int *count, int cmdchar, bool nomove) showmode(); } else if (p_smd && (got_int || !skip_showmode()) && !(p_ch == 0 && !ui_has(kUIMessages))) { - msg("", 0); + unshowmode(false); } // Exit Insert mode return true; diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua @@ -82,7 +82,7 @@ local hl_grid_legacy_c = [[ {15:return} {26:0}; | } | {1:~ }|*2 - | + 14 more lines | ]] local hl_grid_ts_c = [[ @@ -102,7 +102,7 @@ local hl_grid_ts_c = [[ {15:return} {26:0}; | } | {1:~ }|*2 - | + {MATCH:1?4? m?o?r?e? l?i?n?e?s?.*}| ]] local test_text_c = [[ diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua @@ -1663,6 +1663,22 @@ stack traceback: }, }) end) + + it('clears showmode after insert_expand mode', function() + feed('i<C-N>') + screen:expect({ + grid = [[ + ^ | + {1:~ }|*4 + ]], + showmode = { { '-- Keyword completion (^N^P) ', 5, 11 }, { 'Pattern not found', 9, 6 } }, + }) + feed('<Esc>') + screen:expect([[ + ^ | + {1:~ }|*4 + ]]) + end) end) describe('ui/builtin messages', function()