aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index ac192c1..57d04b1 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -292,7 +292,21 @@ void BrowserTab::on_url_bar_returnPressed()
if (url.scheme().isEmpty())
{
- url = QUrl{"gemini://" + this->ui->url_bar->text()};
+ // Need this to get the validation below to work.
+ url.setUrl("internal://" + this->ui->url_bar->text());
+
+ // We check if there is at least a TLD so that single words
+ // are assumed to be searches.
+ if (url.isValid() && url.host().contains("."))
+ {
+ url = QUrl{"gemini://" + urltext};
+ }
+ else
+ {
+ // Use the text as a search query.
+ static const QString search_engine = "gemini://gus.guru/search?%1";
+ url = QUrl{QString(search_engine).arg(this->ui->url_bar->text())};
+ }
}
this->ui->url_bar->clearFocus();