Skip to content

Commit

Permalink
Fix redraw_prompt on MacVim (GUI)
Browse files Browse the repository at this point in the history
It seems MacVim requires an extra 'redraw' to completely redraw.
  • Loading branch information
lambdalisue committed Mar 30, 2017
1 parent 6017e5b commit d1649fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions prompt.py
Expand Up @@ -53,6 +53,10 @@ def __init__(self, nvim):
self.history = History(weakref.proxy(self))
self.action = copy.copy(DEFAULT_ACTION)
self.keymap = Keymap.from_rules(nvim, DEFAULT_KEYMAP_RULES)
# MacVim (GUI) has a problem on 'redraw'
self.is_macvim = (
nvim.call('has', 'gui_running') and nvim.call('has', 'mac')
)

def insert_text(self, text):
"""Insert text after the caret.
Expand Down Expand Up @@ -148,6 +152,9 @@ def redraw_prompt(self):
build_echon_expr(selected_text, self.highlight_caret),
build_echon_expr(forward_text, self.highlight_text),
]))
if self.is_macvim:
# MacVim requires extra 'redraw'
self.nvim.command('redraw')

def start(self):
"""Start prompt and return value.
Expand Down

0 comments on commit d1649fc

Please sign in to comment.