Skip to content

Commit

Permalink
Revert "fix(command): allow reveal_file to be used with dir (#1501)" (#…
Browse files Browse the repository at this point in the history
…1621)

Co-authored-by: pynappo <[email protected]>
  • Loading branch information
alanoliveira and pynappo authored Dec 23, 2024
1 parent 385270e commit 45c75e5
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lua/neo-tree/command/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,26 +210,19 @@ handle_reveal = function(args, state)
-- Deal with cwd if we need to
local cwd = state.path
local path = args.reveal_file
local dir = args.dir
if cwd == nil then
cwd = manager.get_cwd(state)
end

if dir == nil then
dir, _ = utils.split_path(path)
elseif not utils.is_subpath(dir, path) then
error(string.format('%s is not a subpath of %s', path, args.dir))
end

if args.reveal_force_cwd and not utils.is_subpath(cwd, path) then
args.dir = dir
args.dir, _ = utils.split_path(path)
do_show_or_focus(args, state, true)
return
elseif not utils.is_subpath(cwd, path) then
-- force was not specified, so we need to ask the user
inputs.confirm("File not in cwd. Change cwd to " .. dir .. "?", function(response)
cwd, _ = utils.split_path(path)
inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response)
if response == true then
args.dir = dir
args.dir = cwd
else
args.reveal_file = nil
end
Expand Down

0 comments on commit 45c75e5

Please sign in to comment.