summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/message.c
AgeCommit message (Collapse)AuthorFiles
2026-04-24feat(api): nvim_echo(percent=nil) means "unknown" progress #39029Peter Cardenas1
Problem: No way to signal "unknown" or "indeterminate" progress percentage. Solution: Treat percent=nil as "indeterminate" percent.
2026-04-21fix(messages): "progress" kind for busy messages #39280luukvbaal1
Problem: The "Scanning:" completion, bufwrite, and indent (there may be more) messages which indicate progress can use the "progress" kind for their msg_show event. Indent message does not have a kind. Solution: Emit these messages with the "progress" kind. Set the message id to the replaced kind so that a UI knows to replace it (and to provide a migration path in case a UI was distinguishing these messages for whatever reason).
2026-04-09fix(messages): truncate warning messages only in display (#38901)zeertzjq1
For now, add a private "_truncate" flag to nvim_echo, using a truncation method similar to showmode().
2026-04-07fix(message): flush messages before "empty" msg_show #38854luukvbaal1
Problem: When emitting a msg_show event with the "empty" kind, there may still be messages waiting to be emitted, which are then dropped as a result of recursion protection. Solution: Flush messages before emitting "empty" message show.
2026-04-06fix(events): avoid recursive loop_uv_run() from vim.ui_attach() shell messageLuuk van Baal1
Problem: vim.ui_attach() msg_show callback runs the risk of a recursive loop_uv_run() when trying to display a message from a shell command stream. Solution: Schedule the message callback on the fast_events queue.
2026-03-31fix(cmdline): redraw cmdline after empty message (#38485)luukvbaal1
Problem: Cmdline is not redrawn after an empty message clears it. Remembered last drawn cursor position may be outdated but equal to the current cmdline content with UI2. Solution: Ensure cmdline is redrawn after an empty message clears it. Compare wanted cursor position with actual cursor position.
2026-03-28fix(progress): require "source" for progress-message #38514Shadman1
Problem: - Progress-events are filtered by "source". But "source" is not required by nvim_echo. - Without "++nested" (force=false), nvim_echo in an event-handler does not trigger Progress events. - vim.health does not declare a "source". Solution: - Make source mandatory for progress-messages - Enable ++nested (force=true) by default when firing Progress event. - Set "source" in vim.health module.
2026-03-27fix(messages): spurious newline with --headless + cmdheight=0 #38494kq1
Problem: When running nvim in headless mode with `cmdheight=0`, an extra newline is prepended to output (eg. `nvim --clean --cmd 'set cmdheight=0' --headless -c 'echo 1 | q' ` prints `\n1` instead of `1`), because `!ui_has(kUIMessages)` is always true in headless mode, causing `p_ch == 0` in `msg_start()` to unconditionally trigger `msg_putchar('\n')` which writes a newline to stdout. Solution: When in headless printf mode with `p_ch == 0` and no prior output on the current line, call `msg_puts_display("\n", ...)` directly instead of `msg_putchar('\n')`, so the grid is still updated for correct screen positioning but no newline is written to stdout.
2026-03-27feat(progress): set Progress-event pattern to "source" #38495Shadman1
Problem: Currently, there's no way to distinguish progress messages coming from different sources. Nor can Progress event be easily filtered based on source. Solution: - Add "source" field to nvim_echo-opts. - The Progress event pattern is now defined by the "source" field. - Include the "title" as ev.data. - Unrelated change: set force=false to disable nesting.
2026-03-25refactor: resize Progress autocmd dict to actual size #38487Willaaaaaaa1
Problem: The temp_dict in `do_autocmd_progress()` is sized 7, but the max is 6 (id, text, percent, status, title, data). The extra capacity is rather misleading. Solution: make the size of the dict 6.
2026-03-20docs: miscJustin M. Keyes1
2026-03-18fix(messages): disallow user-defined integer message-id #38359Justin M. Keyes1
Problem: `nvim_echo(…, {id=…})` accepts user-defined id as a string or integer. Generated ids are always higher than last highest msg-id used. Thus plugins may accidentally advance the integer id "address space", which, at minimum, could lead to confusion when troubleshooting, or in the worst case, could overflow or "exhaust" the id address space. There's no use-case for it, and it could be the mildly confusing, so we should just disallow it. Solution: Disallow *integer* user-defined message-id. Only allow *string* user-defined message-id.
2026-03-16feat(progress): disable cmdline progress msg via messagesopt' #36730Shadman1
Problem: No way to disable progress messages in cmdline message area. If a third-party plugin handles Progress events + messages, the user may not want the "redundant" progress displayed in the cmdline message area. Solution: Support "progress:c" entry in 'messageopts' option.
2026-03-14fix(messages): allocate message history kind string #38292luukvbaal1
Problem: nvim_echo()->kind memory may be used after it is freed with :messages. Solution: Copy and free message kind string in message history.
2026-03-10fix(lua): extra CR (\r) in `nvim -l` output #38048Commrade Goad1
Problem: `nvim -l` prints an extra `\r` to stdout: :=vim.system({'cmd', '/c', "echo print(1) | nvim -l -"}, {}):wait() { code = 0, signal = 0, stderr = "1\r\r\n", stdout = "" } Solution: Check `headless_mode` in `msg_use_crlf`. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-10Merge #37926 msg_show UI event indicates user-interactiveJustin M. Keyes1
2026-03-10fix(message): concatenate multi-chunk nvim_echo({err}) for exception message ↵luukvbaal1
#38131 Problem: Exception error message only prints the first chunk of a multi-chunk nvim_echo() message. Solution: Concatenate consecutive message chunks in the exception message list.
2026-03-10vim-patch:partial:9.2.0126: String handling can be improved (#38214)zeertzjq1
Problem: String handling can be improved Solution: Pass string length where it is known to avoid strlen() calls, do a few minor refactors (John Marriott). This commit changes some calls to function `set_vim_var_string()` to pass the string length where it is known or can be easily calculated. In addition: In `evalvars.c`: * In function `set_reg_var()` turn variable `regname` into a C string because that is how it used. * Small cosmetics. In `option.c`: * Slightly refactor function `apply_optionset_autocmd()` to move some variables closer to where they are used. In `getchar.c`: * Slightly refactor function `do_key_input_pre()`: -> change call to `dict_add_string()` to `dict_add_string_len()` and pass it the length of `buf`. -> only call `get_vim_var_string()` once. In `message.c`: * Use a `string_T` to store local variable `p`. In `normal.c`: * Move some variables closer to where they are used. closes: vim/vim#19618 https://github.com/vim/vim/commit/727f6e2686fb1d06b9591e6de689763a479cc664 Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-03-09fix(messages): non-fast and append for "shell_*" kinds #38188luukvbaal1
Problem: vim.ui_attach() is unable to display streamed shell output, and will display it as individual messages. Unwanted newlines in "shell_ret" message. Solution: Treat the "shell_*" kinds as non-fast and set msg_show->append for the streamed stdout/err messages. Remove leading newline from (translated) message with ext_messages, remove trailing newline altogether.
2026-03-03vim-patch:9.2.0102: 'listchars' "leadtab" not used in :list (#38142)zeertzjq1
Problem: 'listchars' "leadtab" not used in :list (after 9.2.0088). Solution: Also check for "leadtab" when using :list. Fix memory leak on E1572 if "multispace" or "leadmultispace" is set (zeertzjq). closes: vim/vim#19557 https://github.com/vim/vim/commit/5845741d69655a731288ab105c8fd9fe46e12df9
2026-03-03feat(ui): specify whether msg_show event comes from typed commandLuuk van Baal1
Problem: Unable to tell whether a msg_show event is emitted as a result a command typed on the cmdline (UI may want to represent these differently from other messages). Solution: Add trigger parameter that is set to "typed_cmd" for a message emitted due to an interactively typed command. Possible extensions are mapping/timer/event but it's hard to imagine a UI distinguishing those so not added here.
2026-02-26fix(messages): reset redirection message column at message start #38068luukvbaal1
Problem: Leading message newlines (not emitted with ext_messages since 4260f73) were responsible for resetting the redirection message column (while the newline itself is later pruned...). Solution: Ensure the redirection column is reset at the start of a message. (Instead of re-adjusting all the newline callsites which can themselves hopefully be pruned if ext_messages is enabled by default.)
2026-02-24fix(messages): unwanted ext_messages newlines for confirm() #38045luukvbaal1
Problem: Newlines emitted with ext_messages intended to position the message/prompt on the message grid. Solution: Don't emit these newlines with ext_messages, followup to 4260f73e.
2026-02-23feat(messages): drop hardcoded 'showmode' delay #38029Justin M. Keyes1
Problem: - Editing a 'readonly' file forces a 3-second delay. - nvim_get_mode waits 3 secs with 'showmode' enabled or when there are error messages. Solution: Remove the delay for "ui2", by using `msg_delay`.
2026-02-17fix(highlight): refresh highlight attrs before message output #25737glepnir1
Problem: When MsgArea highlight is changed, the next message may flash and disappear because msg_start() renders with stale highlight attributes. msg_puts_len() uses HL_ATTR(HLF_MSG) to render message text, which happens before update_screen() calls highlight_changed(). So the message is rendered with outdated attrs. Solution: Call highlight_changed() in msg_start().
2026-02-16fix(messages): message not flushed at end of command #37904luukvbaal1
Problem: Logic determining messages belonging to the last command to show with "g<" does not flush pending messages. This can result in clearing the temporary message history before a message still belonging to the previous command was emitted. Solution: Flush pending messages when marking the end of messages belonging to previous command.
2026-02-14fix(messages): heap-buffer-overflow with shell command (#37855)zeertzjq1
Problem: heap-buffer-overflow when showing output of a shell command. Solution: Use xmemrchr() instead of strrchr(). Ref: https://github.com/neovim/neovim/pull/37831#issuecomment-3900149476
2026-02-12fix(ui2): incomplete :echon message in g< pager #37819phanium1
Problem: `:echo 1 | echon 2<cr>g<` shows "2", but should be "12". Solution: Don't clear temp msg (g<) if we are appending.
2026-02-08fix(messages): unwanted newlines with ext_messages #37733luukvbaal1
Problem: Newlines intended to write messages below the cmdline or to mark the start of a new message on message grid are emitted through ext_messages. This results in unnecessary newlines for a UI that has decoupled its message area from the cmdline. msg_col is set directly in some places which is not transmitted to msg_show events. Various missing message kind for list commands. Trailing newlines on various list commands. Solution: Only emit such newlines without ext_messages enabled. Use msg_advance() instead of setting msg_col directly. Assign them the "list_cmd" kind. Ensure no trailing newline is printed.
2026-02-05fix(messages): increment message ID without ext_messages #37714luukvbaal1
Problem: Message ID is not incremented without ext_messages. Solution: Increment where callstack reaches without ext_messages. There is no clear place marking the end of internal messages without ext_messages so IDs are only incremented with `nvim_echo` calls. Message IDs are currently not exposed anywhere but the msg_show event for this to matter.
2026-02-03fix(messages): always assign msg_id to msg_show events #37671luukvbaal1
Problem: Internal messages do not have an ID, which is unexpected and undocumented. Solution: Always assign a msg_id to msg_show events, simplifying logic/expectations for UIs.
2026-01-19fix(messages): adjust msg_show "empty" kind logic (#37427)luukvbaal1
Problem: A message ending in an unprintable character may emit a msg_show event with the "empty" kind. No empty message event for echom "". Solution: Adjust conditions for emitting "empty" msg_show events.
2025-12-20refactor(messages): encapsulate msg_delay logicJustin M. Keyes1
see also 9bbbeb60e355844780db0aef955e860d68ac0342
2025-12-20test(messages): skip os_delay during testsJustin M. Keyes1
Problem: Tests that trigger `os_delay` messages may take 1-3 seconds, wasting build/CI time, since this serves no purpose in tests. Solution: - Introduce `msg_delay` for cases where `os_delay` is being used as a "UI feature". - Skip `msg_delay` in tests.
2025-12-15fix(messages): exclude "search hit BOTTOM" msg from history #36961Ayaan1
Problem: :messages history include the "search hit BOTTOM, continuing at TOP" message, which is noise. Solution: Set msg_hist_off before giving the warning and reset it after warning.
2025-12-14vim-patch:8.2.5161: might still access invalid memoryJan Edmund Lazo1
Problem: Might still access invalid memory. Solution: Add extra check for negative value. https://github.com/vim/vim/commit/0fbc9260a75dfc4d86f20e7c0eb76878f513a212 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-12vim-patch:9.1.1969: Wrong cursor position after formatting with long ↵zeertzjq1
'formatprg' (#36918) Problem: Wrong cursor position after formatting with long 'formatprg'. Solution: Don't show hit-enter prompt when there are stuffed characters. Previously a stuffed character at the hit-enter prompt will dismiss the prompt immediately and be put in the typeahead buffer, which leads to incorrect behavior as the typeahead buffer is processed after the stuff buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem, but since the hit-enter prompt isn't visible anyway (and is likely not desired here), just skip the prompt instead, which also avoids a wait when using "wait" instead of "hit-enter" in 'messagesopt'. fixes: vim/vim#18905 closes: vim/vim#18906 https://github.com/vim/vim/commit/50325c3d591806c57b04512dc103214acd0f2f18
2025-12-09fix: vim.ui_attach handles messages during `-l`/`--headless` #36884phanium1
Problem: With vim.ui_attach in headless mode, messages are still printed. Solution: Don't print to stdout if a vim.ui_attach "messages" handler is defined.
2025-12-09vim-patch:9.1.1965: q can accidentally start recording at more prompt (#36879)zeertzjq1
Problem: When exiting at the end of the more prompt (at the hit enter prompt) by hitting q the recording mode will be started. (Jakub Łuczyński) Solution: Don't add the q key to the typeahead buffer in the function wait_return (Bjoern Foersterling) fixes: vim/vim#2589 closes: vim/vim#18889 https://github.com/vim/vim/commit/ecce3497fa9e1a7452ccfa8ba9cbdadb92bfb7fb Co-authored-by: Bjoern Foersterling <bjoern.foersterling@gmail.com>
2025-10-19vim-patch:8.2.3673: crash when allocating signal stack failsJan Edmund Lazo1
Problem: Crash when allocating signal stack fails. Solution: Only using sourcing info when available. (closes vim/vim#9215) https://github.com/vim/vim/commit/0bd8d0563853ab821a018fb9cdd85f674684fe57 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-14vim-patch:9.1.1849: CTRL-F and CTRL-B don't work in more promptzeertzjq1
Problem: CTRL-F and CTRL-B don't work in more prompt Solution: Make CTRL-F and CTRL-B scroll by a screen down/up (Bjoern Foersterling) closes: vim/vim#18545 https://github.com/vim/vim/commit/fcf4c435af6fe00348506860c1433414d35223a7 Co-authored-by: bfoersterling <bjoern.foersterling@gmail.com>
2025-10-04vim-patch:partial:8.1.1939: code for handling v: variables in generic eval ↵Jan Edmund Lazo1
file (#35968) Problem: Code for handling v: variables in generic eval file. Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4872) https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb Remove direct reference to "vimvars" for following functions: - assert_error() - get_vim_var_nr() - get_vim_var_list() - get_vim_var_dict() - get_vim_var_str() - set_cmdarg() - set_reg_var() - set_vcount() - set_vexception() - set_vthrowpoint() - set_vim_var_bool() - set_vim_var_dict() - set_vim_var_list() - set_vim_var_nr() - set_vim_var_special() - set_vim_var_string() - set_vim_var_type() Reorder functions based on v8.2.4930 for eval_one_expr_in_str() and eval_all_expr_in_str(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-26vim-patch:8.1.2077: the ops.c file is too bigJan Edmund Lazo1
Problem: The ops.c file is too big. Solution: Move code for dealing with registers to a new file. (Yegappan Lakshmanan, closes vim/vim#4982) https://github.com/vim/vim/commit/4aea03eb875613e3eae2125b84f02b7cd898b2f8 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-21perf(events): skip Progress prep if there are no subscribers #35871Justin M. Keyes1
Problem: `do_autocmd_progress` does unnecessary work even if there is no Progress event handler defined. Solution: Check `has_event`.
2025-09-16docs: small fixes (#35791)zeertzjq1
Close #34938 Close #35030 Close #35233 Close #35259 Close #35290 Close #35433 Close #35541 Close #35766 Close #35792 Co-authored-by: huylg <45591413+huylg@users.noreply.github.com> Co-authored-by: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Co-authored-by: sooriya <74165167+thuvasooriya@users.noreply.github.com> Co-authored-by: Andrew Braxton <andrewcbraxton@gmail.com> Co-authored-by: Enric Calabuig <enric.calabuig@gmail.com> Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com> Co-authored-by: David Sierra DiazGranados <davidsierradz@gmail.com> Co-authored-by: Stepan Nikitin <90522882+vectravox@users.noreply.github.com> Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-09-04fix(progress): memory leak on progress-message with history=falseshadmansaleh1
2025-09-04fix(progress): message-id not sent to ui with history set to falseshadmansaleh1
2025-09-03docs: lsp, miscJustin M. Keyes1
- Problem: It's not clear for new plugin developers that `:help` uses a help-tags file for searching the docs, generated by `:helptags`. - Solution: Hint to the |:helptags| docs for regenerating the tags file for their freshly written documentation. Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-09-01feat(progress): better default format + history sync #35533Shadman1
Problem: The default progress message doesn't account for message-status. Also, the title and percent sections don't get written to history. And progress percent is hard to find with variable length messages. Solution: Apply highlighting on Title based on status. And sync the formated msg in history too. Also updates the default progress message format to {title}: {percent}% msg
2025-08-28fix(progress): simplify ui-event, introduce default presentation #35527Shadman1
Problem: `msg_show` has "progress" info (title, status, percent) which is not presented by default. Solution: Format TUI messages as `{title}: {msg}...{percent}%`. This also gets sent to UI. - With specific formatting sent to UI we can remove the `progress` item from `msg_show` event. It can be added if needed in the future. Also, having a default presentation makes the feature more useful. - For `vim._extui` we just need to implement the replace-msg-with-same-id behavior. - If any UI/plugin wants to do anything fancier, they can handle the `Progress` event.