Replace trim() with a version-compatible alternative. (#1265)

* Replace trim() with a version-compatible alternative.

* Update version number in change log.
This commit is contained in:
Phil Runninger 2021-09-14 22:34:57 -04:00 committed by GitHub
parent aa7e97b7ff
commit 7eee457efa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
--> -->
#### 6.10 #### 6.10
- **.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) - **.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) - **.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) - **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)

View File

@ -169,7 +169,7 @@ endfunction
function! NERDTreeAddNode() function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected() let curDirNode = g:NERDTreeDirNode.GetSelected()
let prompt = s:inputPrompt('add') let prompt = s:inputPrompt('add')
let newNodeName = trim(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')) let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
if newNodeName ==# '' if newNodeName ==# ''
call nerdtree#echo('Node Creation Aborted.') call nerdtree#echo('Node Creation Aborted.')
@ -206,7 +206,7 @@ function! NERDTreeMoveNode()
let newNodePath = input(prompt, curNode.path.str(), 'file') let newNodePath = input(prompt, curNode.path.str(), 'file')
while filereadable(newNodePath) while filereadable(newNodePath)
call nerdtree#echoWarning('This destination already exists. Try again.') call nerdtree#echoWarning('This destination already exists. Try again.')
let newNodePath = trim(input(prompt, curNode.path.str(), 'file')) let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
endwhile endwhile
@ -337,7 +337,7 @@ endfunction
function! NERDTreeCopyNode() function! NERDTreeCopyNode()
let currentNode = g:NERDTreeFileNode.GetSelected() let currentNode = g:NERDTreeFileNode.GetSelected()
let prompt = s:inputPrompt('copy') let prompt = s:inputPrompt('copy')
let newNodePath = trim(input(prompt, currentNode.path.str(), 'file')) let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
if newNodePath !=# '' if newNodePath !=# ''
"strip trailing slash "strip trailing slash