diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-11-15 08:27:00 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-15 13:15:40 +0100 |
commit | d28d108648106a19d81b1804211fa195c7fb14f7 (patch) | |
tree | 71d85db8b63715636d925fde50b449a20cfc3cb8 | |
parent | 01ef6fc3d2ac5102fc4e1ee3c0d27643bdfdb775 (diff) | |
download | rneovim-d28d108648106a19d81b1804211fa195c7fb14f7.tar.gz rneovim-d28d108648106a19d81b1804211fa195c7fb14f7.tar.bz2 rneovim-d28d108648106a19d81b1804211fa195c7fb14f7.zip |
CheckHealth: Fix version comparison.
Compare numbers instead of strings.
-rw-r--r-- | runtime/autoload/health/provider.vim | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 0d837e9dea..d3e1fef483 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -1,7 +1,7 @@ let s:shell_error = 0 function! s:is_bad_response(s) abort - return a:s =~? '\v(^unable)|(^error)' + return a:s =~? '\v(^unable)|(^error)|(^outdated)' endfunction function! s:trim(s) abort @@ -10,13 +10,13 @@ endfunction " Simple version comparison. function! s:version_cmp(a, b) abort - let a = split(a:a, '\.') - let b = split(a:b, '\.') + let a = split(a:a, '\.', 0) + let b = split(a:b, '\.', 0) for i in range(len(a)) - if a[i] > b[i] + if str2nr(a[i]) > str2nr(b[i]) return 1 - elseif a[i] < b[i] + elseif str2nr(a[i]) < str2nr(b[i]) return -1 endif endfor @@ -378,7 +378,7 @@ function! s:check_python(version) abort endif call health#report_info('Python'.a:version.' version: ' . pyversion) - call health#report_info(printf('%s-neovim Version: %s', python_bin_name, current)) + call health#report_info(printf('%s-neovim version: %s', python_bin_name, current)) if s:is_bad_response(current) let suggestions = [ @@ -396,9 +396,11 @@ function! s:check_python(version) abort endif if s:is_bad_response(status) - call health#report_warn('Latest Neovim Python client version: ('.latest.')') + call health#report_warn(printf('Latest %s-neovim is NOT installed: %s', + \ python_bin_name, latest)) elseif !s:is_bad_response(latest) - call health#report_ok('Latest Neovim Python client is installed: ('.status.')') + call health#report_ok(printf('Latest %s-neovim is installed: %s', + \ python_bin_name, latest)) endif endif |