commit e731b845590017493224dfcb7403c2332105b700
parent 7eee457efae1bf9b96d7a266ac097639720a68fe
Author: lifecrisis <jrf@elitemail.org>
Date: Mon, 20 Sep 2021 15:01:21 -0400
Ensure backward compatible testing of types (#1266)
- Use "type(0)" instead of "v:t_number"
- Use "==" instead of "==#" since we are comparing numbers
- Make use of the "+=" operator
- Update the "CHANGELOG.md" file
The only real issue here is that we should prefer "type(0)" over the
special variable. I run into this problem enough on older systems
that it frustrates me. Let's have it fixed!
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -5,7 +5,8 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.10
-- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
+- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
+- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
- **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261)
- **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259)
- **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)
diff --git a/autoload/nerdtree.vim b/autoload/nerdtree.vim
@@ -112,18 +112,18 @@ function! nerdtree#compareNodePaths(p1, p2) abort
" Compare chunks upto common length.
" If chunks have different type, the one which has
" integer type is the lesser.
- if type(sortKey1[i]) ==# type(sortKey2[i])
+ if type(sortKey1[i]) == type(sortKey2[i])
if sortKey1[i] <# sortKey2[i]
return - 1
elseif sortKey1[i] ># sortKey2[i]
return 1
endif
- elseif type(sortKey1[i]) ==# v:t_number
+ elseif type(sortKey1[i]) == type(0)
return -1
- elseif type(sortKey2[i]) ==# v:t_number
+ elseif type(sortKey2[i]) == type(0)
return 1
endif
- let i = i + 1
+ let i += 1
endwhile
" Keys are identical upto common length.