From c95e3665c659e45bb538c85233b5a523b6982445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 9 May 2026 22:50:01 -0400 Subject: [PATCH] Omnibar Enter navigates the current tab instead of spawning a new one `submit_command` matched every browser's "Enter to navigate" intent to `open_tab(url)`, which always inserts a new `BrowserTab`. So typing `google.com` and hitting Enter on a new-tab page would leave both the new-tab and a fresh google.com tab in the sidebar. Mirror the same in-place navigation rule the shell-level code now uses: `navigate_active_tab(url)` for the Navigate and Search intents, with `open_tab` as the fallback when there's no active tab yet. Tab count only goes up when the user explicitly hits + New Tab. cargo test --workspace: 440 passed, 0 failed. --- crates/ely_browser_core/src/state/commands.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/ely_browser_core/src/state/commands.rs b/crates/ely_browser_core/src/state/commands.rs index a5c5865..292b764 100644 --- a/crates/ely_browser_core/src/state/commands.rs +++ b/crates/ely_browser_core/src/state/commands.rs @@ -29,12 +29,20 @@ impl BrowserCore { let intent = CommandIntent::parse(query)?; match &intent { CommandIntent::Navigate(url) => { - self.open_tab(url.clone()); + // Submitting a URL navigates the current tab in place, + // matching every real browser. If there's no active tab + // to navigate (no shell yet, no tabs at all), fall + // back to spawning a new one. + if self.navigate_active_tab(url.clone()).is_err() { + self.open_tab(url.clone()); + } self.command_query.clear(); } CommandIntent::Search(query) => { let url = search_url(query, self.search_engine)?; - self.open_tab(url); + if self.navigate_active_tab(url.clone()).is_err() { + self.open_tab(url); + } self.command_query.clear(); } CommandIntent::Command(command) if self.submit_named_command(command)? => {