mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 15:38:41 +08:00
Fix accidental truncation of raw sequences
For numpad 1 with nulock, Alacritty sends escape,[,5,7,4,0,0,u which is codepoint \x31, key "1". We have a terminfo mapping for "sright" which translates to escape,[,1,;,2,C The first two characters, escape and [ match. Then we accidentally match the "1" from the mapping against the entire sequence, because that sequence is canonicalized to codepoint "1" . The most blatant problem is that we discard the rest of the sequence. Fix that. This allows us to re-enable raw CSI u mappings like "bind \e[1u ..." which is what kitty uses for shell integration.
This commit is contained in:
parent
b97187c90b
commit
866585c6ce
|
@ -616,6 +616,7 @@ impl EventQueuePeeker<'_> {
|
|||
|
||||
/// \return the next event.
|
||||
fn next(&mut self) -> CharEvent {
|
||||
assert!(self.subidx == 0);
|
||||
assert!(
|
||||
self.idx <= self.peeked.len(),
|
||||
"Index must not be larger than dequeued event count"
|
||||
|
@ -660,16 +661,12 @@ impl EventQueuePeeker<'_> {
|
|||
let Some(kevt) = evt.get_key() else {
|
||||
return false;
|
||||
};
|
||||
if kevt.key == key {
|
||||
if self.subidx == 0 && kevt.key == key {
|
||||
self.idx += 1;
|
||||
self.subidx = 0;
|
||||
return true;
|
||||
}
|
||||
let actual_seq = kevt.seq.as_char_slice();
|
||||
let is_csi_u = actual_seq.get(0) == Some(&'\x1b')
|
||||
&& actual_seq.get(1) == Some(&'[')
|
||||
&& actual_seq.last() == Some(&'u');
|
||||
if !actual_seq.is_empty() && !is_csi_u {
|
||||
if !actual_seq.is_empty() {
|
||||
let seq_char = actual_seq[self.subidx];
|
||||
if Key::from_single_char(seq_char) == key {
|
||||
self.subidx += 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user