mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
GTextEditor: Move "Go to line" feature from HackStudio into GTextEditor
This is a handy feature for any multi-line GTextEditor, so let's just have it in the base widget. :^) Fixes #1122.
This commit is contained in:
parent
ebfb3d91e2
commit
a33259483a
2 changed files with 15 additions and 14 deletions
|
@ -67,20 +67,6 @@ EditorWrapper::EditorWrapper(GWidget* parent)
|
|||
m_editor->on_focus = [this] {
|
||||
g_current_editor_wrapper = this;
|
||||
};
|
||||
|
||||
m_editor->add_custom_context_menu_action(GAction::create(
|
||||
"Go to line...", { Mod_Ctrl, Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
|
||||
auto input_box = GInputBox::construct("Line:", "Go to line", window());
|
||||
auto result = input_box->exec();
|
||||
if (result == GInputBox::ExecOK) {
|
||||
bool ok;
|
||||
auto line_number = input_box->text_value().to_uint(ok);
|
||||
if (ok) {
|
||||
m_editor->set_cursor(line_number - 1, 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
m_editor));
|
||||
}
|
||||
|
||||
EditorWrapper::~EditorWrapper()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue