mirror of
https://github.com/neovim/neovim.git
synced 2026-04-27 01:34:16 +00:00
feat(ui): "append" parameter for "msg_show" UI events
Problem: Consecutive "msg_show" events stemming from an `:echon`
command are supposed to be appended without a newline, this
information is not encoded in the "msg_show" event.
Solution: Add an "append" parameter to the "msg_show" event that is set
to true to indicate the message should not start on a new line.
Considered alternative: Emit a newline for the common case instead at the
start of a new message. That way UIs can more closely follow the logic
as it is implemented for the message grid currently. This would be a
breaking change. The "append" parameter seems OK.
This commit is contained in:
@@ -1383,12 +1383,12 @@ function Screen:_handle_wildmenu_hide()
|
||||
self.wildmenu_items, self.wildmenu_pos = nil, nil
|
||||
end
|
||||
|
||||
function Screen:_handle_msg_show(kind, chunks, replace_last, history)
|
||||
function Screen:_handle_msg_show(kind, chunks, replace_last, history, append)
|
||||
local pos = #self.messages
|
||||
if not replace_last or pos == 0 then
|
||||
pos = pos + 1
|
||||
end
|
||||
self.messages[pos] = { kind = kind, content = chunks, history = history }
|
||||
self.messages[pos] = { kind = kind, content = chunks, history = history, append = append }
|
||||
end
|
||||
|
||||
function Screen:_handle_msg_clear()
|
||||
@@ -1507,7 +1507,8 @@ function Screen:_extstate_repr(attr_state)
|
||||
messages[i] = {
|
||||
kind = entry.kind,
|
||||
content = self:_chunks_repr(entry.content, attr_state),
|
||||
history = entry.history,
|
||||
history = entry.history or nil,
|
||||
append = entry.append or nil,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user