mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Cmd or Ctrl+L should focus on location bar in minibrowser mode (#30105)
* cmd or ctrl+L should focus on location bar * review fix: rename response to location_field
This commit is contained in:
parent
1efecf9b50
commit
0e7c958bd5
2 changed files with 21 additions and 14 deletions
|
@ -113,6 +113,7 @@ where
|
|||
}
|
||||
})
|
||||
.shortcut(CMD_OR_CONTROL, 'L', || {
|
||||
if !opts::get().minibrowser {
|
||||
let url: String = if let Some(ref current_url) = self.current_url {
|
||||
current_url.to_string()
|
||||
} else {
|
||||
|
@ -127,6 +128,7 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.shortcut(CMD_OR_CONTROL, 'Q', || {
|
||||
self.event_queue.push(EmbedderEvent::Quit);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::{cell::{RefCell, Cell}, sync::Arc};
|
||||
|
||||
use egui::TopBottomPanel;
|
||||
use egui::{TopBottomPanel, Modifiers, Key};
|
||||
use servo::{servo_url::ServoUrl, compositing::windowing::EmbedderEvent};
|
||||
use servo::webrender_surfman::WebrenderSurfman;
|
||||
|
||||
|
@ -55,12 +55,17 @@ impl Minibrowser {
|
|||
event_queue.borrow_mut().push(MinibrowserEvent::Go);
|
||||
location_dirty.set(false);
|
||||
}
|
||||
if ui.add_sized(
|
||||
|
||||
let location_field = ui.add_sized(
|
||||
ui.available_size(),
|
||||
egui::TextEdit::singleline(&mut *location.borrow_mut()),
|
||||
).changed() {
|
||||
);
|
||||
if location_field.changed() {
|
||||
location_dirty.set(true);
|
||||
}
|
||||
if ui.input(|i| i.clone().consume_key(Modifiers::COMMAND, Key::L)) {
|
||||
location_field.request_focus();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue