fix(windows): navigating into drive letter root directories (#341)
* Fixed drive browsing on windows * Fixed naming * fix: Uppercase drive letter only * updated: Filter out network drives on windows * Update files.lua * Update files.lua * fixed: mapped drives * addslash to check for double slash * Fixed indents * Reverted addslash change * Fixed windows initial buffer name * Reverted formatting * Cleaned up callback * Fix addslash to handle \ too * Allow running tests workflow from fork * Fix workflow * Test * Tests * refactor: readability and comments * fix: convert buffer name to posix when hijacking directory --------- Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
This commit is contained in:
parent
3b3a6b23a1
commit
f3a31eba24
2 changed files with 25 additions and 7 deletions
|
|
@ -727,6 +727,7 @@ end
|
|||
---@return boolean
|
||||
local function maybe_hijack_directory_buffer(bufnr)
|
||||
local config = require("oil.config")
|
||||
local fs = require("oil.fs")
|
||||
local util = require("oil.util")
|
||||
if not config.default_file_explorer then
|
||||
return false
|
||||
|
|
@ -738,10 +739,10 @@ local function maybe_hijack_directory_buffer(bufnr)
|
|||
if util.parse_url(bufname) or vim.fn.isdirectory(bufname) == 0 then
|
||||
return false
|
||||
end
|
||||
local replaced = util.rename_buffer(
|
||||
bufnr,
|
||||
util.addslash(config.adapter_to_scheme.files .. vim.fn.fnamemodify(bufname, ":p"))
|
||||
local new_name = util.addslash(
|
||||
config.adapter_to_scheme.files .. fs.os_to_posix_path(vim.fn.fnamemodify(bufname, ":p"))
|
||||
)
|
||||
local replaced = util.rename_buffer(bufnr, new_name)
|
||||
return not replaced
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue