summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DevTools/HackStudio/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp
index 54696cc157..dd306fa228 100644
--- a/DevTools/HackStudio/main.cpp
+++ b/DevTools/HackStudio/main.cpp
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <unistd.h>
+NonnullRefPtrVector<EditorWrapper> g_all_editor_wrappers;
RefPtr<EditorWrapper> g_current_editor_wrapper;
String g_currently_open_file;
@@ -38,6 +39,7 @@ void add_new_editor(GWidget& parent)
{
auto wrapper = EditorWrapper::construct(&parent);
g_current_editor_wrapper = wrapper;
+ g_all_editor_wrappers.append(wrapper);
}
EditorWrapper& current_editor_wrapper()
@@ -120,6 +122,18 @@ int main(int argc, char** argv)
open_file(filename);
});
+ auto switch_to_next_editor = GAction::create("Switch to next editor", { Mod_Ctrl, Key_E }, [&](auto&) {
+ if (g_all_editor_wrappers.size() <= 1)
+ return;
+ // FIXME: This will only work correctly when there are 2 editors. Make it work for any editor count.
+ for (auto& wrapper : g_all_editor_wrappers) {
+ if (&wrapper == &current_editor_wrapper())
+ continue;
+ wrapper.editor().set_focus(true);
+ return;
+ }
+ });
+
auto save_action = GAction::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
if (g_currently_open_file.is_empty())
return;