mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibWebView+QT: Support bangs at the end
This commit is contained in:
parent
33c5fd31c1
commit
992c80c355
1 changed files with 12 additions and 0 deletions
|
@ -50,6 +50,18 @@ LocationEdit::LocationEdit(QWidget* parent)
|
|||
query = MUST(query.substring_from_byte_offset(splits[0].bytes().size()));
|
||||
}
|
||||
}
|
||||
// FIXME: low quality code. this can be merged into the if branch
|
||||
auto const temp = query.split(' ');
|
||||
if (!temp.is_error()) {
|
||||
auto const last = temp.value().last();
|
||||
if (temp.value().last().starts_with('!')) {
|
||||
auto exist = WebView::find_search_engine_by_bang(last);
|
||||
if (exist.has_value()) {
|
||||
search_engine_url = exist->query_url;
|
||||
query = MUST(query.substring_from_byte_offset(0, query.bytes().size() - last.bytes().size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto url = WebView::sanitize_url(query, search_engine_url); url.has_value())
|
||||
|
|
Loading…
Reference in a new issue