From 69eee2097f31d83ed1579450b1bbb0d5eee8b136 Mon Sep 17 00:00:00 2001 From: micbou Date: Sat, 20 Jun 2015 04:46:26 +0200 Subject: [PATCH] Redraw the screen before displaying a message This avoids the infamous "Press ENTER or type command to continue" prompt when editing a new C-family file. --- python/ycm/vimsupport.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 6b168f237b..0de7ac8535 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -358,11 +358,13 @@ def NumLinesInBuffer( buffer_object ): return len( buffer_object ) -# Calling this function from the non-GUI thread will sometimes crash Vim. At the -# time of writing, YCM only uses the GUI thread inside Vim (this used to not be -# the case). +# Calling this function from the non-GUI thread will sometimes crash Vim. At +# the time of writing, YCM only uses the GUI thread inside Vim (this used to +# not be the case). +# We redraw the screen before displaying the message to avoid the "Press ENTER +# or type command to continue" prompt when editing a new C-family file. def PostVimMessage( message ): - vim.command( "echohl WarningMsg | echom '{0}' | echohl None" + vim.command( "redraw | echohl WarningMsg | echom '{0}' | echohl None" .format( EscapeForVim( str( message ) ) ) )