mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 15:01:16 -03:00
fish_key_reader: ignore sentinel key
Also, move the undo grouping for paste to the right place.
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
eprintf, fprintf,
|
eprintf, fprintf,
|
||||||
input::input_terminfo_get_name,
|
input::input_terminfo_get_name,
|
||||||
input_common::{CharEvent, InputEventQueue, InputEventQueuer},
|
input_common::{CharEvent, InputEventQueue, InputEventQueuer},
|
||||||
key::Key,
|
key::{self, Key},
|
||||||
panic::panic_handler,
|
panic::panic_handler,
|
||||||
print_help::print_help,
|
print_help::print_help,
|
||||||
printf,
|
printf,
|
||||||
@@ -117,6 +117,9 @@ fn process_input(continuous_mode: bool) -> i32 {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let c = kevt.key.codepoint;
|
let c = kevt.key.codepoint;
|
||||||
|
if c == key::Invalid {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bind_chars.push((kevt.key, kevt.seq));
|
bind_chars.push((kevt.key, kevt.seq));
|
||||||
output_bind_command(&mut bind_chars);
|
output_bind_command(&mut bind_chars);
|
||||||
if output_matching_key_name(&mut recent_chars1, c) {
|
if output_matching_key_name(&mut recent_chars1, c) {
|
||||||
|
|||||||
@@ -456,11 +456,13 @@ fn uvar_change_notified(&mut self) {
|
|||||||
|
|
||||||
fn paste_start_buffering(&mut self) {
|
fn paste_start_buffering(&mut self) {
|
||||||
self.paste_buffer = Some(vec![]);
|
self.paste_buffer = Some(vec![]);
|
||||||
|
self.push_front(CharEvent::from_readline(ReadlineCmd::BeginUndoGroup));
|
||||||
}
|
}
|
||||||
fn paste_is_buffering(&self) -> bool {
|
fn paste_is_buffering(&self) -> bool {
|
||||||
self.paste_buffer.is_some()
|
self.paste_buffer.is_some()
|
||||||
}
|
}
|
||||||
fn paste_commit(&mut self) {
|
fn paste_commit(&mut self) {
|
||||||
|
self.push_front(CharEvent::from_readline(ReadlineCmd::EndUndoGroup));
|
||||||
let buffer = self.paste_buffer.take().unwrap();
|
let buffer = self.paste_buffer.take().unwrap();
|
||||||
self.push_front(CharEvent::Command(sprintf!(
|
self.push_front(CharEvent::Command(sprintf!(
|
||||||
"__fish_paste %s",
|
"__fish_paste %s",
|
||||||
|
|||||||
@@ -869,11 +869,9 @@ fn parse_csi(&mut self, buffer: &mut Vec<u8>) -> Option<Key> {
|
|||||||
} // rxvt style
|
} // rxvt style
|
||||||
200 => {
|
200 => {
|
||||||
self.paste_start_buffering();
|
self.paste_start_buffering();
|
||||||
self.push_front(CharEvent::from_readline(ReadlineCmd::BeginUndoGroup));
|
|
||||||
return Some(Key::from_raw(key::Invalid));
|
return Some(Key::from_raw(key::Invalid));
|
||||||
}
|
}
|
||||||
201 => {
|
201 => {
|
||||||
self.push_front(CharEvent::from_readline(ReadlineCmd::EndUndoGroup));
|
|
||||||
self.paste_commit();
|
self.paste_commit();
|
||||||
return Some(Key::from_raw(key::Invalid));
|
return Some(Key::from_raw(key::Invalid));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
pub(crate) const Insert: char = '\u{F50c}';
|
pub(crate) const Insert: char = '\u{F50c}';
|
||||||
pub(crate) const Tab: char = '\u{F50d}';
|
pub(crate) const Tab: char = '\u{F50d}';
|
||||||
pub(crate) const Space: char = '\u{F50e}';
|
pub(crate) const Space: char = '\u{F50e}';
|
||||||
pub(crate) const Invalid: char = '\u{F50f}';
|
pub const Invalid: char = '\u{F50f}';
|
||||||
pub(crate) fn function_key(n: u32) -> char {
|
pub(crate) fn function_key(n: u32) -> char {
|
||||||
assert!((1..=12).contains(&n));
|
assert!((1..=12).contains(&n));
|
||||||
char::from_u32(u32::from(Invalid) + n).unwrap()
|
char::from_u32(u32::from(Invalid) + n).unwrap()
|
||||||
|
|||||||
Reference in New Issue
Block a user