mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:37:36 +00:00
LibGUI: Single-line GUI::TextEditor should not have "go to line" action
This commit is contained in:
parent
580a94bc44
commit
7323d085dd
1 changed files with 14 additions and 12 deletions
|
@ -86,18 +86,20 @@ void TextEditor::create_actions()
|
||||||
m_copy_action = CommonActions::make_copy_action([&](auto&) { copy(); }, this);
|
m_copy_action = CommonActions::make_copy_action([&](auto&) { copy(); }, this);
|
||||||
m_paste_action = CommonActions::make_paste_action([&](auto&) { paste(); }, this);
|
m_paste_action = CommonActions::make_paste_action([&](auto&) { paste(); }, this);
|
||||||
m_delete_action = CommonActions::make_delete_action([&](auto&) { do_delete(); }, this);
|
m_delete_action = CommonActions::make_delete_action([&](auto&) { do_delete(); }, this);
|
||||||
m_go_to_line_action = Action::create(
|
if (is_multi_line()) {
|
||||||
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
|
m_go_to_line_action = Action::create(
|
||||||
auto input_box = InputBox::construct("Line:", "Go to line", window());
|
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
|
||||||
auto result = input_box->exec();
|
auto input_box = InputBox::construct("Line:", "Go to line", window());
|
||||||
if (result == InputBox::ExecOK) {
|
auto result = input_box->exec();
|
||||||
bool ok;
|
if (result == InputBox::ExecOK) {
|
||||||
auto line_number = input_box->text_value().to_uint(ok);
|
bool ok;
|
||||||
if (ok)
|
auto line_number = input_box->text_value().to_uint(ok);
|
||||||
set_cursor(line_number - 1, 0);
|
if (ok)
|
||||||
}
|
set_cursor(line_number - 1, 0);
|
||||||
},
|
}
|
||||||
this);
|
},
|
||||||
|
this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditor::set_text(const StringView& text)
|
void TextEditor::set_text(const StringView& text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue