Skip to content

Commit 7eee457

Browse files
Replace trim() with a version-compatible alternative. (#1265)
* Replace trim() with a version-compatible alternative. * Update version number in change log.
1 parent aa7e97b commit 7eee457

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
66
-->
77
#### 6.10
8+
- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
89
- **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261)
910
- **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259)
1011
- **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)

nerdtree_plugin/fs_menu.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ endfunction
169169
function! NERDTreeAddNode()
170170
let curDirNode = g:NERDTreeDirNode.GetSelected()
171171
let prompt = s:inputPrompt('add')
172-
let newNodeName = trim(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'))
172+
let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
173173

174174
if newNodeName ==# ''
175175
call nerdtree#echo('Node Creation Aborted.')
@@ -206,7 +206,7 @@ function! NERDTreeMoveNode()
206206
let newNodePath = input(prompt, curNode.path.str(), 'file')
207207
while filereadable(newNodePath)
208208
call nerdtree#echoWarning('This destination already exists. Try again.')
209-
let newNodePath = trim(input(prompt, curNode.path.str(), 'file'))
209+
let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
210210
endwhile
211211

212212

@@ -337,7 +337,7 @@ endfunction
337337
function! NERDTreeCopyNode()
338338
let currentNode = g:NERDTreeFileNode.GetSelected()
339339
let prompt = s:inputPrompt('copy')
340-
let newNodePath = trim(input(prompt, currentNode.path.str(), 'file'))
340+
let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
341341

342342
if newNodePath !=# ''
343343
"strip trailing slash

0 commit comments

Comments
 (0)