neovim/runtime
zeertzjq 62dc1f2663
vim-patch:8750e3cf81f1 (#26163)
runtime(netrw): Fix handling of very long filename on longlist style (vim/vim#12150)

If there is a file with a very long filename (longer than
g:netrw_maxfilenamelen), and if g:netrw_liststyle is set to 1, no space
is inserted between the filename and the filesize and the file cannot be
opened because of this.

E.g.:
```
$ echo hello > 12345678901234567890123456789012	  # 32 bytes: OK
$ echo hello > 123456789012345678901234567890123  # 33 bytes: not OK
$ echo hello > 1234567890123456789012345678901234 # 34 bytes: not OK
$ echo hello > こんにちは                         # multibyte filename
$ LC_ALL=C.UTF-8 vim . --clean --cmd "set loadplugins" --cmd "let g:netrw_liststyle=1"
```

Then, it will be shown like this:
```
" ============================================================================
" Netrw Directory Listing                                        (netrw v171)
"   /cygdrive/c/work/netrw-test
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                              0 Mon Mar 13 19:25:16 2023
./                               0 Mon Mar 13 19:44:58 2023
12345678901234567890123456789012 6 Mon Mar 13 19:29:43 2023
12345678901234567890123456789012346 Mon Mar 13 19:32:40 2023
1234567890123456789012345678901236 Mon Mar 13 19:29:49 2023
こんにちは                  6 Mon Mar 13 19:30:41 2023
```

If the length of the filename is 32 bytes, there is a space between the
filename and the filesize. However, when it is longer than 32 bytes, no
space is shown.

Also, you may find that the filesize of the multibyte named file is not
aligned.

After this patch is applied, the filelist will be shown like this:
```
" ============================================================================
" Netrw Directory Listing                                        (netrw v171)
"   /cygdrive/c/work/netrw-test
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                                             0 Mon Mar 13 20:49:22 2023
./                                              0 Mon Mar 13 21:12:14 2023
1234567890123456789012345678901             10000 Mon Mar 13 20:57:55 2023
12345678901234567890123456789012                6 Mon Mar 13 19:29:43 2023
123456789012345678901234567890123               6 Mon Mar 13 19:29:49 2023
1234567890123456789012345678901234              6 Mon Mar 13 19:32:40 2023
1234567890123456789012345678901234567       10000 Mon Mar 13 21:03:23 2023
1234567890123456789012345678901234567890    10000 Mon Mar 13 21:03:36 2023
123456789012345678901234567890123456789012  10000 Mon Mar 13 21:03:59 2023
1234567890123456789012345678901234567890123  10000 Mon Mar 13 21:03:45 2023
1234567890123456789012345678901234567890123456  5 Mon Mar 13 21:08:15 2023
12345678901234567890123456789012345678901234567  10 Mon Mar 13 21:05:21 2023
こんにちは                                      6 Mon Mar 13 19:30:41 2023
```

Now we have 32 + 2 + 15 = 49 characters for filename and filesize.
It tries to align the filesize as much as possible.
The last line that has multibyte filename is also aligned.

Also fixed the issue that the file list is not shown correctly when
g:netrw_sort_by is set to 'size' and g:netrw_sizestyle is set to 'h' or
'H'.

8750e3cf81

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-11-23 17:02:53 +08:00
..
autoload vim-patch:8750e3cf81f1 (#26163) 2023-11-23 17:02:53 +08:00
colors vim-patch:dbf749bd5aae (#25665) 2023-10-16 16:36:25 +08:00
compiler vim-patch:fc93594d562d 2023-09-13 17:23:45 +02:00
doc feat(extmarks): add sign name to extmark "details" array 2023-11-22 12:43:59 +01:00
ftplugin vim-patch:9.0.2104: wast filetype should be replaced by wat filetype 2023-11-14 21:51:28 +01:00
indent vim-patch:9.0.2104: wast filetype should be replaced by wat filetype 2023-11-14 21:51:28 +01:00
keymap vim-patch:caee7956a21a 2023-11-05 21:56:56 +01:00
lua vim-patch:596a9f29c83a (#26146) 2023-11-22 10:46:11 +08:00
macros vim-patch:e8d6f03f6a61 2023-08-23 20:36:16 +01:00
pack/dist/opt vim-patch:2dd613f57bf1 (#26009) 2023-11-13 05:44:30 +08:00
plugin fix(osc52): enable OSC 52 by default in tmux sessions (#26072) 2023-11-16 13:56:05 -06:00
queries feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
spell
syntax vim-patch:9.0.2104: wast filetype should be replaced by wat filetype 2023-11-14 21:51:28 +01:00
tools
tutor fix(tutor): Tutor steps don't work on Windows #25251 2023-09-26 06:31:35 -07:00
CMakeLists.txt
delmenu.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
filetype.lua fix(filetype): make sure buffer is valid before call nvim_buf_call (#24922) 2023-08-30 10:14:58 -05:00
ftoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugin.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugof.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indent.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
macmap.vim
makemenu.vim vim-patch:9.0.2104: wast filetype should be replaced by wat filetype 2023-11-14 21:51:28 +01:00
menu.vim vim-patch:e059fae10044 2023-08-24 11:33:06 +09:00
mswin.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
neovim.ico
nvim.appdata.xml
nvim.desktop
nvim.png
optwin.vim vim-patch:0b8b145bf8bf 2023-08-31 10:58:54 +02:00
synmenu.vim vim-patch:9.0.2104: wast filetype should be replaced by wat filetype 2023-11-14 21:51:28 +01:00