summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-10 19:39:30 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-10 19:49:49 +0100
commit7323d085dd5963ce920e7dda8a7ec5030b4cd596 (patch)
tree195aaed38013b3a51060dba82eb35c1042729699 /Libraries/LibGUI
parent580a94bc44bcea61bf1b07abf24c1b00e43a1d64 (diff)
downloadserenity-7323d085dd5963ce920e7dda8a7ec5030b4cd596.zip
LibGUI: Single-line GUI::TextEditor should not have "go to line" action
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/TextEditor.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index fbde0779c7..6353357869 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -86,18 +86,20 @@ void TextEditor::create_actions()
m_copy_action = CommonActions::make_copy_action([&](auto&) { copy(); }, this);
m_paste_action = CommonActions::make_paste_action([&](auto&) { paste(); }, this);
m_delete_action = CommonActions::make_delete_action([&](auto&) { do_delete(); }, this);
- m_go_to_line_action = Action::create(
- "Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
- auto input_box = InputBox::construct("Line:", "Go to line", window());
- auto result = input_box->exec();
- if (result == InputBox::ExecOK) {
- bool ok;
- auto line_number = input_box->text_value().to_uint(ok);
- if (ok)
- set_cursor(line_number - 1, 0);
- }
- },
- this);
+ if (is_multi_line()) {
+ m_go_to_line_action = Action::create(
+ "Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
+ auto input_box = InputBox::construct("Line:", "Go to line", window());
+ auto result = input_box->exec();
+ if (result == InputBox::ExecOK) {
+ bool ok;
+ auto line_number = input_box->text_value().to_uint(ok);
+ if (ok)
+ set_cursor(line_number - 1, 0);
+ }
+ },
+ this);
+ }
}
void TextEditor::set_text(const StringView& text)