aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-22 14:49:38 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-22 14:49:38 +0100
commite2a19ee524cd8bd1003b0a7e59b1490f3e1d1e67 (patch)
treea0f1fce326cadcca97b86d3a48052aeb44cc196d
parentd58ea43d93fb41519fad6547cf6533d76ecd2441 (diff)
Fix ctrl+h acting as backspace, fix remaining vim key for remaining plugins
-rw-r--r--src/ImageViewer.cpp8
-rw-r--r--src/QuickMedia.cpp12
-rw-r--r--src/SearchBar.cpp4
3 files changed, 13 insertions, 11 deletions
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
index 8704c15..6efc688 100644
--- a/src/ImageViewer.cpp
+++ b/src/ImageViewer.cpp
@@ -194,9 +194,9 @@ namespace QuickMedia {
} else if(event.type == sf::Event::GainedFocus) {
//redraw = true;
} else if(event.type == sf::Event::KeyPressed) {
- if(event.key.code == sf::Keyboard::Up)
+ if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K))
up_pressed = true;
- if(event.key.code == sf::Keyboard::Down)
+ if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J))
down_pressed = true;
if(event.key.code == sf::Keyboard::Escape) {
@@ -208,9 +208,9 @@ namespace QuickMedia {
if(event.key.code == sf::Keyboard::I)
return ImageViewerAction::SWITCH_TO_SINGLE_IMAGE_MODE;
} else if(event.type == sf::Event::KeyReleased) {
- if(event.key.code == sf::Keyboard::Up)
+ if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K))
up_pressed = false;
- if(event.key.code == sf::Keyboard::Down)
+ if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J))
down_pressed = false;
} else if(event.type == sf::Event::MouseWheelScrolled && event.mouseWheelScroll.wheel == sf::Mouse::VerticalWheel) {
scroll_speed += scroll_speed_mouse_wheel * event.mouseWheelScroll.delta * frame_delta;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 2eb369c..210a31b 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2265,7 +2265,7 @@ namespace QuickMedia {
} else if(event.type == sf::Event::GainedFocus) {
redraw = true;
} else if(event.type == sf::Event::KeyPressed) {
- if(event.key.code == sf::Keyboard::Up) {
+ if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K)) {
if(image_index > 0) {
--image_index;
goto end_of_images_page;
@@ -2273,7 +2273,7 @@ namespace QuickMedia {
page_navigation = -1;
goto end_of_images_page;
}
- } else if(event.key.code == sf::Keyboard::Down) {
+ } else if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J)) {
if(image_index < num_images) {
++image_index;
goto end_of_images_page;
@@ -2655,9 +2655,9 @@ namespace QuickMedia {
if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus)
redraw = true;
else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == sf::Event::KeyPressed) {
- if(event.key.code == sf::Keyboard::Up) {
+ if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K)) {
thread_body->select_previous_item();
- } else if(event.key.code == sf::Keyboard::Down) {
+ } else if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J)) {
thread_body->select_next_item();
} else if(event.key.code == sf::Keyboard::PageUp) {
thread_body->select_previous_page();
@@ -4248,9 +4248,9 @@ namespace QuickMedia {
}
}
} else if(event.type == sf::Event::KeyPressed && chat_state == ChatState::URL_SELECTION) {
- if(event.key.code == sf::Keyboard::Up) {
+ if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K)) {
url_selection_body.select_previous_item();
- } else if(event.key.code == sf::Keyboard::Down) {
+ } else if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J)) {
url_selection_body.select_next_item();
} else if(event.key.code == sf::Keyboard::PageUp) {
url_selection_body.select_previous_page();
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 9b02903..739a0b6 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -94,8 +94,10 @@ namespace QuickMedia {
backspace_pressed = false;
if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::V && event.key.control)
append_text(sf::Clipboard::getString());
- if(event.type == sf::Event::TextEntered)
+ if(event.type == sf::Event::TextEntered && event.text.unicode != 8 && event.text.unicode != 127) // 8 = backspace, 127 = del
onTextEntered(event.text.unicode);
+ else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Backspace)
+ onTextEntered(8);
}
void SearchBar::update() {