mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +00:00
HackStudio: Jump to file location when choosing a Locator suggestion
A couple of tweaks here to make it work better: - Call `set_cursor_and_focus_line()` to make the Editor scroll to the symbol's location. - Remove focus from the Locator's text box so your cursor jumps to the Editor instead of staying in the Locator.
This commit is contained in:
parent
9322f0d110
commit
d30f13a88d
2 changed files with 3 additions and 2 deletions
|
@ -318,7 +318,7 @@ bool HackStudioWidget::open_file(ByteString const& full_filename, size_t line, s
|
|||
|
||||
if (editor_wrapper_or_none.has_value()) {
|
||||
set_current_editor_wrapper(editor_wrapper_or_none.release_value());
|
||||
current_editor().set_cursor(line, column);
|
||||
current_editor().set_cursor_and_focus_line(line, column);
|
||||
return true;
|
||||
} else if (active_file().is_empty() && !current_editor().document().is_modified() && !full_filename.is_empty()) {
|
||||
// Replace "Untitled" blank file since it hasn't been modified
|
||||
|
@ -384,7 +384,7 @@ bool HackStudioWidget::open_file(ByteString const& full_filename, size_t line, s
|
|||
current_editor().on_cursor_change = [this] { on_cursor_change(); };
|
||||
current_editor().on_change = [this] { update_window_title(); };
|
||||
current_editor_wrapper().on_change = [this] { update_gml_preview(); };
|
||||
current_editor().set_cursor(line, column);
|
||||
current_editor().set_cursor_and_focus_line(line, column);
|
||||
update_gml_preview();
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue