nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.72k stars 455 forks source link

fix: escape filename after it has been shortened #1159

Closed ozymohliad closed 6 months ago

ozymohliad commented 7 months ago

When you try to open a file with a long filename that has a % at the start of one of the path segments, the percent sign will first get escaped and then the path segment that contains it may get shortened to a single character which "unescapes" the percent sign:

  1. Original filename: aaaaaa/bbbbbb/%cccccc/dddddd/file.txt
  2. Escaped filename: aaaaaa/bbbbbb/%%cccccc/dddddd/file.txt
  3. Shortened filename: a/b/%/d/file.txt instead of a/b/%%/d/file.txt

This bug is likely more common than it may first seem. I found it by jumping to a function definition which was in a java library class with a URL-like filename (it started with jdt://). There were a few \ symbols encoded as %5C that caused lualine to crash.

shadmansaleh commented 6 months ago

lgtm. thanks for your contribution.