summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/res/icons/16x16/select-all.pngbin0 -> 1311 bytes
-rw-r--r--Libraries/LibGUI/TextEditor.cpp8
-rw-r--r--Libraries/LibGUI/TextEditor.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/Base/res/icons/16x16/select-all.png b/Base/res/icons/16x16/select-all.png
new file mode 100644
index 0000000000..f3f01b3c18
--- /dev/null
+++ b/Base/res/icons/16x16/select-all.png
Binary files differ
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index 967ab401ec..86295b37e1 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -98,6 +98,8 @@ void TextEditor::create_actions()
},
this);
}
+ m_select_all_action = Action::create(
+ "Select all", { Mod_Ctrl, Key_A },Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"), [this](auto&) { select_all(); }, this);
}
void TextEditor::set_text(const StringView& text)
@@ -812,10 +814,6 @@ void TextEditor::keydown_event(KeyEvent& event)
}
return;
}
- if (event.modifiers() == Mod_Ctrl && event.key() == KeyCode::Key_A) {
- select_all();
- return;
- }
if (event.alt() && event.shift() && event.key() == KeyCode::Key_S) {
sort_selected_lines();
return;
@@ -1277,6 +1275,8 @@ void TextEditor::context_menu_event(ContextMenuEvent& event)
m_context_menu->add_action(copy_action());
m_context_menu->add_action(paste_action());
m_context_menu->add_action(delete_action());
+ m_context_menu->add_separator();
+ m_context_menu->add_action(select_all_action());
if (is_multi_line()) {
m_context_menu->add_separator();
m_context_menu->add_action(go_to_line_action());
diff --git a/Libraries/LibGUI/TextEditor.h b/Libraries/LibGUI/TextEditor.h
index 15bc844973..760c4d4903 100644
--- a/Libraries/LibGUI/TextEditor.h
+++ b/Libraries/LibGUI/TextEditor.h
@@ -121,6 +121,7 @@ public:
Action& paste_action() { return *m_paste_action; }
Action& delete_action() { return *m_delete_action; }
Action& go_to_line_action() { return *m_go_to_line_action; }
+ Action& select_all_action() { return *m_select_all_action; }
void add_custom_context_menu_action(Action&);
@@ -233,6 +234,7 @@ private:
RefPtr<Action> m_paste_action;
RefPtr<Action> m_delete_action;
RefPtr<Action> m_go_to_line_action;
+ RefPtr<Action> m_select_all_action;
Core::ElapsedTimer m_triple_click_timer;
NonnullRefPtrVector<Action> m_custom_context_menu_actions;