Skip to content

Commit

Permalink
shift-space now emits space
Browse files Browse the repository at this point in the history
This isn't a 100% righteous fix, but is sufficient to reduce
the irritation in refs: #126

The full fix is pending another round of review of the CSI-u stuff
in refs: #63
  • Loading branch information
wez committed Jan 24, 2020
1 parent ffa00be commit e45bace
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions term/src/terminalstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,19 @@ fn encode_modifiers(mods: KeyModifiers) -> u8 {
number
}

// FIXME: provide an option to enable this, because it is super annoying
// in vim when accidentally pressing shift-space and it emits a sequence
// that undoes some number of commands
const ENABLE_CSI_U: bool = false;

fn csi_u_encode(buf: &mut String, c: char, mods: KeyModifiers) -> Result<(), Error> {
// FIXME: provide an option to enable this, because it is super annoying
// in vim when accidentally pressing shift-space and it emits a sequence
// that undoes some number of commands
if false {
if ENABLE_CSI_U {
write!(buf, "\x1b[{};{}u", c as u32, 1 + encode_modifiers(mods))?;
} else {
// FIXME: this ignores the modifiers completely. That's sort of
// OK, but eg: CTRL-SPACE should really send a NUL byte in that
// case, so this isn't great
write!(buf, "{}", c)?;
}
Ok(())
}
Expand Down

0 comments on commit e45bace

Please sign in to comment.