mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
Browser: Set the console's interpreter when a tab's document changes
Previously, once a console was opened for a tab, its interpreter would never change, leaving it with a stale interpreter. Now, when the tab's HtmlView loads a new document, the console will receive that document's interpreter.
This commit is contained in:
parent
51e79a2bbc
commit
20df82c983
Notes:
sideshowbarker
2024-07-19 06:11:39 +09:00
Author: https://github.com/FalseHonesty
Commit: 20df82c983
Pull-request: https://github.com/SerenityOS/serenity/pull/2349
Reviewed-by: https://github.com/Dexesttp
Reviewed-by: https://github.com/linusg
1 changed files with 7 additions and 0 deletions
|
@ -206,6 +206,13 @@ Tab::Tab()
|
||||||
on_favicon_change(icon);
|
on_favicon_change(icon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m_html_widget->on_set_document = [this](auto* document) {
|
||||||
|
if (document && m_console_window) {
|
||||||
|
auto* console_widget = static_cast<ConsoleWidget*>(m_console_window->main_widget());
|
||||||
|
console_widget->set_interpreter(document->interpreter().make_weak_ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto focus_location_box_action = GUI::Action::create(
|
auto focus_location_box_action = GUI::Action::create(
|
||||||
"Focus location box", { Mod_Ctrl, Key_L }, [this](auto&) {
|
"Focus location box", { Mod_Ctrl, Key_L }, [this](auto&) {
|
||||||
m_location_box->select_all();
|
m_location_box->select_all();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue