瀏覽代碼

VimVersionAtLeast was not "at least" for minor/major version differences

Spencer G. Jones 9 年之前
父節點
當前提交
7e9333a9c2
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      python/ycm/vimsupport.py

+ 8 - 2
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 ) )