fix: shift-tab mappings broken after efc2b4c7
This commit is contained in:
parent
fa0cb010e1
commit
d3def16584
@ -25,6 +25,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) => {
|
||||
|
@ -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 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
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);
|
||||
|
@ -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 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
})));
|
||||
|
||||
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') => {
|
||||
|
@ -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 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user