From e512efe3696b2ed18db55683fecf42bbc733c767 Mon Sep 17 00:00:00 2001 From: phanium <91544758+phanen@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:45:41 +0800 Subject: [PATCH] fix(extui): attempt to perform arithmetic on field 'last_emsg' (#35047) Co-authored-by: Luuk van Baal --- runtime/lua/vim/_extui/messages.lua | 2 +- test/functional/ui/messages2_spec.lua | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/lua/vim/_extui/messages.lua b/runtime/lua/vim/_extui/messages.lua index f7632d8bfa..5fc247020d 100644 --- a/runtime/lua/vim/_extui/messages.lua +++ b/runtime/lua/vim/_extui/messages.lua @@ -388,7 +388,7 @@ function M.msg_show(kind, content, replace_last, _, append) end -- Store the time when an important message was emitted in order to not overwrite -- it with 'last' virt_text in the cmdline so that the user has a chance to read it. - M.cmd.last_emsg = kind == 'emsg' or kind == 'wmsg' and os.time() or M.cmd.last_emsg + M.cmd.last_emsg = (kind == 'emsg' or kind == 'wmsg') and os.time() or M.cmd.last_emsg -- Should clear the search count now, mark itself is cleared by invalidate. M.virt.last[M.virt.idx.search][1] = nil end diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 45a7a24bea..b5306d1b07 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -202,7 +202,7 @@ describe('messages2', function() screen:expect_unchanged() end) - it("'readonly' warning can be read", function() + it('showmode does not overwrite important messages', function() command('set readonly') feed('i') screen:expect([[ @@ -210,5 +210,11 @@ describe('messages2', function() {1:~ }|*12 {19:W10: Warning: Changing a readonly file} | ]]) + feed('Qi') + screen:expect([[ + ^ | + {1:~ }|*12 + {9:E354: Invalid register name: '^@'} | + ]]) end) end)