From 2715e326ac02cb40a322cd14ac5f35210c02d227 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 8 Jan 2026 08:50:56 -0700 Subject: [PATCH] Select first completion if current location does not exist --- src/tab.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tab.rs b/src/tab.rs index ff8029a..da6fb05 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -3504,7 +3504,21 @@ impl Tab { self.edit_location = Some(self.location.clone().into()); } Message::EditLocationSubmit => { - if let Some(edit_location) = self.edit_location.take() { + if let Some(mut edit_location) = self.edit_location.take() { + // Select first completion if current location does not exist + if edit_location.selected.is_none() + && edit_location + .completions + .as_ref() + .map_or(false, |completions| !completions.is_empty()) + && edit_location + .location + .path_opt() + .map_or(false, |path| !path.exists()) + { + edit_location.selected = Some(0); + } + cd = edit_location.resolve(); } }