From 7e9333a9c270fbbb2683e2b98a55a92cef87b930 Mon Sep 17 00:00:00 2001 From: "Spencer G. Jones" Date: Fri, 28 Aug 2015 08:26:04 -0600 Subject: [PATCH] VimVersionAtLeast was not "at least" for minor/major version differences --- python/ycm/vimsupport.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 62200003..27c634a6 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -60,14 +60,20 @@ def TextAfterCursor(): return vim.current.line[ CurrentColumn(): ] +def TextBeforeCursor(): + """Returns the text before CurrentColumn.""" + return vim.current.line[ :CurrentColumn() ] + + # Expects version_string in 'MAJOR.MINOR.PATCH' format, e.g. '7.4.301' def VimVersionAtLeast( version_string ): major, minor, patch = [ int( x ) for x in version_string.split( '.' ) ] # For Vim 7.4.301, v:version is '704' actual_major_and_minor = GetIntValue( 'v:version' ) - if actual_major_and_minor != major * 100 + minor: - return False + matching_major_and_minor = major * 100 + minor + if actual_major_and_minor != matching_major_and_minor: + return actual_major_and_minor > matching_major_and_minor return GetBoolValue( 'has("patch{0}")'.format( patch ) )