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.
This commit is contained in:
luukvbaal
2025-04-24 21:11:49 +02:00
committed by GitHub
parent 18e8839c80
commit 276860b538
3 changed files with 19 additions and 3 deletions

View File

@@ -3458,7 +3458,7 @@ static bool ins_esc(int *count, int cmdchar, bool nomove)
showmode(); showmode();
} else if (p_smd && (got_int || !skip_showmode()) } else if (p_smd && (got_int || !skip_showmode())
&& !(p_ch == 0 && !ui_has(kUIMessages))) { && !(p_ch == 0 && !ui_has(kUIMessages))) {
msg("", 0); unshowmode(false);
} }
// Exit Insert mode // Exit Insert mode
return true; return true;

View File

@@ -82,7 +82,7 @@ local hl_grid_legacy_c = [[
{15:return} {26:0}; | {15:return} {26:0}; |
} | } |
{1:~ }|*2 {1:~ }|*2
| 14 more lines |
]] ]]
local hl_grid_ts_c = [[ local hl_grid_ts_c = [[
@@ -102,7 +102,7 @@ local hl_grid_ts_c = [[
{15:return} {26:0}; | {15:return} {26:0}; |
} | } |
{1:~ }|*2 {1:~ }|*2
| {MATCH:1?4? m?o?r?e? l?i?n?e?s?.*}|
]] ]]
local test_text_c = [[ local test_text_c = [[

View File

@@ -1663,6 +1663,22 @@ stack traceback:
}, },
}) })
end) 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) end)
describe('ui/builtin messages', function() describe('ui/builtin messages', function()