fix(pickers): improve CRLF line splitting support for windows (#3127)

* fix(help_tags): show help tags on windows (#3126)

On Windows, `builtin.help_tags` picker does not show any help tags.

To fix this, the following changes are needed:

1. `util.path_tail` checks unix separator `/` on Windows and leave the
original implementation intact on unix systems.

2. Line endings should be taken carefully on Windows. `vim.split` with
   only newline `\n` character as separator may result in unexpected
   crash when parsing large files. When splits on lines are needed, call
   it with `\r?\n`, or even set up a wrapper function in utils is more
   prefered.

Fixes #3126

* fix: handle cross platform line splits
This commit is contained in:
xudyang1
2024-05-26 10:15:31 -04:00
committed by GitHub
parent c2ce039188
commit 349660c0d3
5 changed files with 124 additions and 14 deletions

View File

@@ -1090,7 +1090,7 @@ previewers.highlights = defaulter(function(_)
define_preview = function(self, entry)
if not self.state.bufname then
local output = vim.split(vim.fn.execute "highlight", "\n")
local output = utils.split_lines(vim.fn.execute "highlight")
local hl_groups = {}
for _, v in ipairs(output) do
if v ~= "" then