diff options
-rw-r--r-- | src/nvim/message.c | 6 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 977b37f8c3..4e06a050c9 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -139,7 +139,7 @@ static const char *msg_ext_kind = NULL; static Array *msg_ext_chunks = NULL; static garray_T msg_ext_last_chunk = GA_INIT(sizeof(char), 40); static sattr_T msg_ext_last_attr = -1; -static int msg_ext_hl_id; +static int msg_ext_last_hl_id; static size_t msg_ext_cur_len = 0; static bool msg_ext_overwrite = false; ///< will overwrite last message @@ -2128,7 +2128,7 @@ static void msg_ext_emit_chunk(void) msg_ext_last_attr = -1; String text = ga_take_string(&msg_ext_last_chunk); ADD(chunk, STRING_OBJ(text)); - ADD(chunk, INTEGER_OBJ(msg_ext_hl_id)); + ADD(chunk, INTEGER_OBJ(msg_ext_last_hl_id)); ADD(*msg_ext_chunks, ARRAY_OBJ(chunk)); } @@ -2145,9 +2145,9 @@ static void msg_puts_display(const char *str, int maxlen, int hl_id, int recurse if (ui_has(kUIMessages)) { if (attr != msg_ext_last_attr) { - msg_ext_hl_id = hl_id; msg_ext_emit_chunk(); msg_ext_last_attr = attr; + msg_ext_last_hl_id = hl_id; } // Concat pieces with the same highlight size_t len = maxlen < 0 ? strlen(str) : strnlen(str, (size_t)maxlen); diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index d48af589ea..804ba83698 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -420,15 +420,15 @@ describe('ui/ext_messages', function() { content = { { '\nErrorMsg ' }, - { 'xxx', 9, 0 }, + { 'xxx', 9, 7 }, { ' ' }, - { 'ctermfg=', 18, 0 }, + { 'ctermfg=', 18, 6 }, { '15 ' }, - { 'ctermbg=', 18, 0 }, + { 'ctermbg=', 18, 6 }, { '1 ' }, - { 'guifg=', 18, 0 }, + { 'guifg=', 18, 6 }, { 'White ' }, - { 'guibg=', 18, 0 }, + { 'guibg=', 18, 6 }, { 'Red' }, }, kind = '', @@ -502,7 +502,7 @@ describe('ui/ext_messages', function() items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } }, pos = 1, }, - showmode = { { '-- Keyword Local completion (^N^P) ', 5, 19 }, { 'match 1 of 2', 6, 19 } }, + showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 1 of 2', 6, 19 } }, } -- echomsg and showmode don't overwrite each other, this is the same @@ -524,7 +524,7 @@ describe('ui/ext_messages', function() content = { { 'stuff' } }, kind = 'echomsg', } }, - showmode = { { '-- Keyword Local completion (^N^P) ', 5, 19 }, { 'match 1 of 2', 6, 19 } }, + showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 1 of 2', 6, 19 } }, } feed('<c-p>') @@ -544,7 +544,7 @@ describe('ui/ext_messages', function() content = { { 'stuff' } }, kind = 'echomsg', } }, - showmode = { { '-- Keyword Local completion (^N^P) ', 5, 19 }, { 'match 2 of 2', 6, 19 } }, + showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 2 of 2', 6, 19 } }, } feed('<esc>:messages<cr>') @@ -945,7 +945,7 @@ stack traceback: { content = { { '\nn Q @@\nn Y y$\nn j ' }, - { '*', 18, 0 }, + { '*', 18, 1 }, { ' k' }, }, kind = '', @@ -1044,7 +1044,7 @@ stack traceback: ]], messages = { { - content = { { 'wow, ', 10, 7 }, { 'such\n\nvery ', 9, 13 }, { 'color', 8, 13 } }, + content = { { 'wow, ', 10, 9 }, { 'such\n\nvery ', 9, 7 }, { 'color', 8, 13 } }, kind = 'echomsg', }, }, |