vim-devicons icon indicating copy to clipboard operation
vim-devicons copied to clipboard

Missing Icons after adding files when using g:NERDTreeNaturalSort

Open kreskij opened this issue 7 years ago • 4 comments

Neovim v0.2.3-dev Webdevicons Version 0.10.0 (latest at the time of the creation of this issue)

Not a critical bug for me, I can just disable NERDTree's natural sort to fix it but I might as well point it out. NaturalSort is disabled by default in NERDtree so it would only affect those who have enabled it via let g:NERDTreeNaturalSort = 1

Problem: When adding multiple files via NERDTRee's file-action menu, I hit 'r' for refresh, and icons appear and disappear under certain circumstances. It seems as though NERDTree's sorting feature is causing the issue. The issue does not always occur, I think it depends on the actual filenames added and whether or not they change the sort order under Natural Sorting rules.

Vimrc

let g:NERDTreeNaturalSort  = 1
call plug#begin(g:Vars.plugins_dirpath)
  Plug 'scrooloose/nerdtree'
  Plug 'ryanoasis/vim-devicons'
call plug#end()

Steps to reproduce

  1. Open NERDTree
  2. Add a file 'TEST_00.txt' (filename is important here)
  3. Hit 'r' to refresh. Icon shows up as expected (no problem here)
  4. Add a second file, 'TEST_0.txt' (note, only one zero this time)
  5. Hit 'r' to refresh. Note the missing icons on one of the two files.

Also, if I created the files in reverse order, TEST_0.txt followed by TEST_00.txt, there is no issue.

kreskij avatar Apr 17 '18 07:04 kreskij

Pressing R would solve the problem since it refreshes all nodes not just current one. I think this is related to https://github.com/ryanoasis/vim-devicons/issues/224, after adding a file or folder vim-devicons need to invoke an automatic refresh to keep icons up to date.

kutsan avatar Apr 17 '18 08:04 kutsan

This is with pressing 'r' after each new file added. I'm aware of the other issue about icons not showing up until manually refreshed with 'r'. This is a little different in that 'r' still leaves nodes without icons, and in some cases, existing nodes with existing icons will even disappear. I think it has something to do with the sorting, as this issue only appears with g:NERDTreeNaturalSort = 1. Maybe the issues are related but this is different behaviour in that hitting 'r' for refresh does not fix the icons, and in some cases, causes multiple icons to disappear after adding only one file. It may even be an issue or limitation with NERDTree, I'm not entirely sure. For now, I'll just disable natural sort, it's not a very important feature for me.

kreskij avatar Apr 18 '18 02:04 kreskij

I mean I was talking about capital R not r.

kutsan avatar Apr 18 '18 11:04 kutsan

Ohh capital 'R', good point and sorry I missed that. However, even with capital 'R' the problem is still occurring no different than with lower-case 'r'.

kreskij avatar Apr 19 '18 01:04 kreskij