mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Don't allow minibrowser tab titles to be empty (#33229)
* avoid unnecessary clones when setting tab title in minibrowser This is of course not a performance issue, but rather just bad style. Especially since the url doesn't even need to be .clone()'d in the first place. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Don't allow empty tab titles in minibrowser These look very confusing. If the page has no title its better to fall back to the url instead of displaying absolutely nothing. (This is what firefox seems to do too) Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
ef42ac0dfc
commit
7c4ba51f51
1 changed files with 4 additions and 4 deletions
|
@ -275,10 +275,10 @@ impl Minibrowser {
|
|||
egui::Layout::left_to_right(egui::Align::Center),
|
||||
|ui| {
|
||||
for (webview_id, webview) in webviews.webviews().into_iter() {
|
||||
let msg = match (webview.title.clone(), webview.url.clone()) {
|
||||
(Some(title), _) => title,
|
||||
(None, Some(url)) => url.to_string(),
|
||||
_ => "".to_owned(),
|
||||
let msg = match (&webview.title, &webview.url) {
|
||||
(Some(title), _) if !title.is_empty() => title.clone(),
|
||||
(_, Some(url)) => url.to_string(),
|
||||
_ => "New Tab".to_owned(),
|
||||
};
|
||||
let tab = ui.add(SelectableLabel::new(
|
||||
webview.focused,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue