aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/keymap.rs16
-rw-r--r--helix-term/src/ui/menu.rs4
-rw-r--r--helix-term/src/ui/picker.rs4
-rw-r--r--helix-term/src/ui/prompt.rs4
4 files changed, 22 insertions, 6 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 1a9ea231..e3e01995 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -26,6 +26,22 @@ macro_rules! key {
}
#[macro_export]
+macro_rules! shift {
+ ($key:ident) => {
+ ::helix_view::input::KeyEvent {
+ code: ::helix_view::keyboard::KeyCode::$key,
+ modifiers: ::helix_view::keyboard::KeyModifiers::SHIFT,
+ }
+ };
+ ($($ch:tt)*) => {
+ ::helix_view::input::KeyEvent {
+ code: ::helix_view::keyboard::KeyCode::Char($($ch)*),
+ modifiers: ::helix_view::keyboard::KeyModifiers::SHIFT,
+ }
+ };
+}
+
+#[macro_export]
macro_rules! ctrl {
($key:ident) => {
::helix_view::input::KeyEvent {
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 8278bd29..e891c149 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -1,6 +1,6 @@
use crate::{
compositor::{Component, Compositor, Context, EventResult},
- ctrl, key,
+ ctrl, key, shift,
};
use crossterm::event::Event;
use tui::{buffer::Buffer as Surface, widgets::Table};
@@ -202,7 +202,7 @@ impl<T: Item + 'static> Component for Menu<T> {
return close_fn;
}
// arrow up/ctrl-p/shift-tab prev completion choice (including updating the doc)
- key!(BackTab) | key!(Up) | ctrl!('p') | ctrl!('k') => {
+ shift!(BackTab) | key!(Up) | ctrl!('p') | ctrl!('k') => {
self.move_up();
(self.callback_fn)(cx.editor, self.selection(), MenuEvent::Update);
return EventResult::Consumed(None);
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 970d3946..c44b7625 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -1,6 +1,6 @@
use crate::{
compositor::{Component, Compositor, Context, EventResult},
- ctrl, key,
+ ctrl, key, shift,
ui::EditorView,
};
use crossterm::event::Event;
@@ -404,7 +404,7 @@ impl<T: 'static> Component for Picker<T> {
})));
match key_event.into() {
- key!(BackTab) | key!(Up) | ctrl!('p') | ctrl!('k') => {
+ shift!(BackTab) | key!(Up) | ctrl!('p') | ctrl!('k') => {
self.move_up();
}
key!(Tab) | key!(Down) | ctrl!('n') | ctrl!('j') => {
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 9a60196f..deed1609 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -1,5 +1,5 @@
use crate::compositor::{Component, Compositor, Context, EventResult};
-use crate::{alt, ctrl, key, ui};
+use crate::{alt, ctrl, key, shift, ui};
use crossterm::event::Event;
use helix_view::input::KeyEvent;
use helix_view::keyboard::{KeyCode, KeyModifiers};
@@ -496,7 +496,7 @@ impl Component for Prompt {
self.change_completion_selection(CompletionDirection::Forward);
(self.callback_fn)(cx, &self.line, PromptEvent::Update)
}
- key!(BackTab) => {
+ shift!(BackTab) => {
self.change_completion_selection(CompletionDirection::Backward);
(self.callback_fn)(cx, &self.line, PromptEvent::Update)
}