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.
This commit is contained in:
micbou 2015-06-20 04:46:26 +02:00
parent a24cc3c662
commit 69eee2097f

View File

@ -358,11 +358,13 @@ def NumLinesInBuffer( buffer_object ):
return len( buffer_object ) return len( buffer_object )
# Calling this function from the non-GUI thread will sometimes crash Vim. At the # Calling this function from the non-GUI thread will sometimes crash Vim. At
# time of writing, YCM only uses the GUI thread inside Vim (this used to not be # the time of writing, YCM only uses the GUI thread inside Vim (this used to
# the case). # 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 ): def PostVimMessage( message ):
vim.command( "echohl WarningMsg | echom '{0}' | echohl None" vim.command( "redraw | echohl WarningMsg | echom '{0}' | echohl None"
.format( EscapeForVim( str( message ) ) ) ) .format( EscapeForVim( str( message ) ) ) )