dont clear text on bang switch

This commit is contained in:
Fabian Freund
2026-05-26 05:59:34 +02:00
parent ec34a28c13
commit 8aecc92eab
@@ -289,14 +289,9 @@ class _BangChipsList extends HookConsumerWidget {
} }
void _handleSelection(BuildContext context, WidgetRef ref, BangData bang) { void _handleSelection(BuildContext context, WidgetRef ref, BangData bang) {
// Text clearing logic: // Only clear text when it parses as a URL — searching a URL via a bang
// - Site tab (domain != null): only clear if text is a valid URL // makes no sense. Otherwise preserve the query so the user can run it
// - All tab (domain == null): always clear (same as original BangChips) // against the newly selected provider.
if (domain == null) {
// All tab / new tab mode - always clear
searchTextController.clear();
} else {
// Site tab - only clear if text is a valid URL
final hasSupportedScheme = final hasSupportedScheme =
uri_parser uri_parser
.tryParseUrl(searchTextController.text) .tryParseUrl(searchTextController.text)
@@ -306,7 +301,6 @@ class _BangChipsList extends HookConsumerWidget {
if (hasSupportedScheme) { if (hasSupportedScheme) {
searchTextController.clear(); searchTextController.clear();
} }
}
// Clear the OTHER provider for mutual exclusion // Clear the OTHER provider for mutual exclusion
if (siteDomain != null) { if (siteDomain != null) {