From 2315cc3f338583e000e93952404904df8c93d53f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 19 Sep 2022 22:57:38 +0200 Subject: Fix tab moving with ctrl+num writing number in search bar. Fix tab moving with vim keys moving in body and tab... --- README.md | 4 ++-- src/SearchBar.cpp | 5 ++++- src/Tabs.cpp | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 038585e..cb3a591 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Type text and then wait and QuickMedia will automatically search.\ `Arrow down`/`Ctrl+J`: Move down.\ `Left`/`Ctrl+H`: Move left.\ `Right`/`Ctrl+L`: Move right.\ -`Ctrl+Left`/`Ctrl+H`/`Ctrl+Shift+Tab`: Select the tab to the left.\ -`Ctrl+Right`/`Ctrl+L`/`Ctrl+Tab`: Select the tab to the right.\ +`Ctrl+Left`/`Ctrl+H`/`Ctrl+Shift+Tab`/`Alt+H`: Select the tab to the left.\ +`Ctrl+Right`/`Ctrl+L`/`Ctrl+Tab`/`Alt+L`: Select the tab to the right.\ `Ctrl+1 to 9`: Select the specified tab.\ `Home`: Scroll to the top (the first item).\ `End`: Scroll to the bottom (the last item).\ diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp index 2371762..0c097a3 100644 --- a/src/SearchBar.cpp +++ b/src/SearchBar.cpp @@ -133,7 +133,10 @@ namespace QuickMedia { const bool pressing_ctrl = (event.type == mgl::Event::KeyPressed && event.key.control); if(pressing_ctrl && (event.type != mgl::Event::TextEntered || event.text.codepoint != 13)) // Enter - return; + return; + + if(event.type == mgl::Event::TextEntered && window.is_key_pressed(mgl::Keyboard::LControl) && !window.is_key_pressed(mgl::Keyboard::LAlt)) + return; if(event.type == mgl::Event::TextEntered && event.text.codepoint != 8 && event.text.codepoint != 127) { // 8 = backspace, 127 = del onTextEntered(event.text); diff --git a/src/Tabs.cpp b/src/Tabs.cpp index f3c9ee4..a5c371a 100644 --- a/src/Tabs.cpp +++ b/src/Tabs.cpp @@ -70,10 +70,10 @@ namespace QuickMedia { void Tabs::on_event(mgl::Event &event) { if(event.type == mgl::Event::KeyPressed && event.key.control && !tabs.empty()) { - bool move_left = (event.key.code == mgl::Keyboard::Left || (event.key.control && event.key.code == mgl::Keyboard::H)); + bool move_left = (event.key.code == mgl::Keyboard::Left || (event.key.alt && event.key.code == mgl::Keyboard::H)); move_left |= (event.key.code == mgl::Keyboard::Tab && event.key.shift); - bool move_right = (event.key.code == mgl::Keyboard::Right || (event.key.control && event.key.code == mgl::Keyboard::L)); + bool move_right = (event.key.code == mgl::Keyboard::Right || (event.key.alt && event.key.code == mgl::Keyboard::L)); move_right |= (event.key.code == mgl::Keyboard::Tab && !event.key.shift); if(move_left) { -- cgit v1.2.3