Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting is not refreshed after the directory is renamed #880

Closed
zgpio opened this issue Aug 31, 2018 · 0 comments
Closed

Sorting is not refreshed after the directory is renamed #880

zgpio opened this issue Aug 31, 2018 · 0 comments
Assignees

Comments

@zgpio
Copy link

zgpio commented Aug 31, 2018

Environment

  • Operating System: Windows10
  • Vim version :version: Vim 8.1
  • NERDTree version git rev-parse --short HEAD: 808f5b2
  • NERDTree settings applied in your vimrc, if any:
    let g:NERDTreeNaturalSort = 1

Process

  1. Just mkdir like follow:
    default
  2. Rename dir 01 to 03, you will get:
    default

Current Result

Expected Result

Sorting need be refreshed after the directory is renamed.

Screenshot(s)

Possible Fix

PhilRunninger pushed a commit that referenced this issue Oct 17, 2018
The problem in issue #880 was caused by the sort using the old sortKey.
For example, given nodes A, B, and C, if B were renamed to D, the sort
was still using B as its sortKey, thus not moving it.

It's a bit of a hack, but if we set g:NERDTreeOldSortOrder to an empty
list, the cached sortKey will be recalculated. I did the same thing for
both the Copy and Add functions as well.
@PhilRunninger PhilRunninger self-assigned this Oct 17, 2018
@PhilRunninger PhilRunninger added the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Oct 17, 2018
PhilRunninger added a commit that referenced this issue Oct 18, 2018
* Force sort to recalculate the cached sortKey.

The problem in issue #880 was caused by the sort using the old sortKey.
For example, given nodes A, B, and C, if B were renamed to D, the sort
was still using B as its sortKey, thus not moving it.

It's a bit of a hack, but if we set g:NERDTreeOldSortOrder to an empty
list, the cached sortKey will be recalculated. I did the same thing for
both the Copy and Add functions as well.

* Add a comment to explain the let ... = [] statement.
@PhilRunninger PhilRunninger removed the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants