Skip to content

Commit

Permalink
fix: Alt and Ctrl being swapped in the text editor on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Jun 16, 2024
1 parent bee4b90 commit 3ce9dbb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,13 +623,18 @@ ImU32 TextEditor::GetGlyphColor(const Glyph &aGlyph) const {

void TextEditor::HandleKeyboardInputs() {
ImGuiIO &io = ImGui::GetIO();

// command => Ctrl
// control => Super
// option => Alt

auto shift = io.KeyShift;
auto left = ImGui::IsKeyPressed(ImGuiKey_LeftArrow);
auto right = ImGui::IsKeyPressed(ImGuiKey_RightArrow);
auto up = ImGui::IsKeyPressed(ImGuiKey_UpArrow);
auto down = ImGui::IsKeyPressed(ImGuiKey_DownArrow);
auto ctrl = io.ConfigMacOSXBehaviors ? io.KeyAlt : io.KeyCtrl;
auto alt = io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeyAlt;
auto ctrl = io.KeyCtrl;
auto alt = io.KeyAlt;
auto home = io.ConfigMacOSXBehaviors ? io.KeySuper && left : ImGui::IsKeyPressed(ImGuiKey_Home);
auto end = io.ConfigMacOSXBehaviors ? io.KeySuper && right : ImGui::IsKeyPressed(ImGuiKey_End);
auto top = io.ConfigMacOSXBehaviors ? io.KeySuper && up : ctrl && ImGui::IsKeyPressed(ImGuiKey_Home);
Expand Down

0 comments on commit 3ce9dbb

Please sign in to comment.