Skip to content

Commit

Permalink
fix: handle windows file paths as uris (#2640)
Browse files Browse the repository at this point in the history
* fix: handle windows file paths as uris

* nit: rename FILE_PATH_PATTERN to WINDOWS_ROOT_PATTERN

(cherry picked from commit bc2330b)
  • Loading branch information
TM10YMhp authored and Conni2461 committed Sep 5, 2023
1 parent 947cb46 commit 1384b2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/telescope/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ utils.is_path_hidden = function(opts, path_display)
end

local URI_SCHEME_PATTERN = "^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*"
local WINDOWS_ROOT_PATTERN = "^[a-zA-Z]:\\"
utils.is_uri = function(filename)
return filename:match(URI_SCHEME_PATTERN) ~= nil
local is_uri_match = filename:match(URI_SCHEME_PATTERN) ~= nil
local is_windows_root_match = filename:match(WINDOWS_ROOT_PATTERN)
return is_uri_match and not is_windows_root_match
end

local calc_result_length = function(truncate_len)
Expand Down

0 comments on commit 1384b2e

Please sign in to comment.