Skip to content

Commit c984b76

Browse files
committed
fix: move logic expression to if statement
If `M.window_picker.custom_function()` returns `nil` then `pick_win_id()` will run (the or part). We don't want that. More verbose, but better.
1 parent ef2ef2e commit c984b76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ local function get_target_winid(mode, win_ids)
175175
end
176176
else
177177
-- pick a window
178-
target_winid = M.window_picker.custom_function and M.window_picker.custom_function() or pick_win_id()
178+
if M.window_picker.custom_function then
179+
target_winid = M.window_picker.custom_function()
180+
else
181+
target_winid = pick_win_id()
182+
end
179183
if target_winid == nil then
180184
-- pick failed/cancelled
181185
return

0 commit comments

Comments
 (0)