UI Protocol: make neovim send hint for history hiding #12929
Comments
@GeorgeSheridan yes I think it is. If any interested newcomer has questions, just ping me : ) |
Howdy @bfredl I'm a newcomer, love Neo(Vim) and would love to give it a shot. Mind if I do? |
@claudemuller please go ahead. Also join https://gitter.im/neovim/neovim for general questions about development :) |
@claudemuller any updates? |
@claudemuller @devbhansingh Here's a small reproducer if you want: import time
from pynvim import attach
from threading import Thread
def isInteresting (evt):
return True
class UIThread(Thread):
def __init__(self, nvim):
Thread.__init__(self)
self.nvim = nvim
self.do_print = False
def run(self):
self.nvim.run_loop(self.callback, self.callback)
def callback(self, event_name, events):
if self.do_print:
[print(event) for event in events if isInteresting(event[0])]
nvim = attach('child', argv=["nvim", "--embed", "-u", "NORC", "-i", "NONE"])
ui = UIThread(nvim)
ui.start()
# Create a ui with 5 lines of 80 characters.
nvim.async_call(nvim.ui_attach, 80, 5, ext_linegrid = True, ext_messages = True, rgb = True)
# Fillup history
nvim.async_call(nvim.input, ":echom 1<CR>")
nvim.async_call(nvim.input, ":echom 2<CR>")
nvim.async_call(nvim.input, ":echom 3<CR>")
time.sleep(1)
ui.do_print = True
# Print history
nvim.async_call(nvim.input, ":messages<CR>")
# Simulate user pressing keys
time.sleep(1)
nvim.async_call(nvim.input, ":<Esc>")
time.sleep(1)
ui.do_print = False
nvim.async_call(nvim.input, ":qa!<Enter>")
time.sleep(1) This will print the following:
Notice how there aren't any But replace
|
import time def isInteresting (evt): class UIThread(Thread): nvim = attach('child', argv=["nvim", "--embed", "-u", "NORC", "-i", "NONE"]) Create a ui with 5 lines of 80 characters.nvim.async_call(nvim.ui_attach, 80, 5, ext_linegrid = True, ext_messages = True, rgb = True) Fillup historynvim.async_call(nvim.input, ":echom 1") time.sleep(1) Print historynvim.async_call(nvim.input, ":messages") Simulate user pressing keystime.sleep(1) time.sleep(1) |
It is currently expected that UIs will figure out when to hide
msg_history_show
messages by themselves.I think this is bad for two reasons:
press ENTER
prompt when the time to hidemsg_history_show
messages has come.After discussing this on Gitter, @bfredl suggests hooking in the
press ENTER
mechanism in a configurable way:I'm not sure I see the value of doing this for all message kinds as neovim already tells UI when to hide them and the TUI does not offer a
press ENTER
prompt every time a message isecho
'ed, but it would be useful to have that for msg_history_show.The text was updated successfully, but these errors were encountered: