fix: vim.ui_attach handles messages during -l/--headless #36884

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.
This commit is contained in:
phanium authored and GitHub committed 2025-12-09 12:32:49 -05:00
1 parent abb907a47d
commit 71a22e20ad
1 file changed
+2 -1
+2 -1
View File
@@ -2862,9 +2862,10 @@ static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
/// @return true when messages should be printed to stdout/stderr:
/// - "batch mode" ("silent mode", -es/-Es/-l)
/// - no UI and not embedded
/// - no ext_messages
int msg_use_printf(void)
{
return !embedded_mode && !ui_active();
return !embedded_mode && !ui_active() && !ui_has(kUIMessages);
}
/// Print a message when there is no valid screen.