Fix ctrl-J processing

The front-end was treating both \r and \n as Enter and passing
that through to the terminal.

To verify behavior, pay attention to your termios configuration:

```
$ stty -icrnl
$ od -c
<CTRL-J><CTRL-D>
0000000   \n
0000001
$ od -c
<CTRL-M><CTRL-D><Enter>
0000000   \r  \n
0000002
```

Closes https://github.com/wez/wezterm/issues/56
This commit is contained in:
Wez Furlong committed 2019-11-03 22:01:35 -08:00
1 parent bb637e9884
commit c99e2989ef
2 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -186,7 +186,7 @@ impl WindowCallbacks for TermWindow {
let key = match key.key {
// TODO: consider eliminating these codes from termwiz::input::KeyCode
WK::Char('\r') | WK::Char('\n') => KC::Enter,
WK::Char('\r') => KC::Enter,
WK::Char('\t') => KC::Tab,
WK::Char('\u{08}') => KC::Backspace,
WK::Char('\u{1b}') => KC::Escape,
+4 -4
View File
@@ -828,10 +828,6 @@ impl WindowView {
let unmod = unsafe { nsstring_to_str(nsevent.charactersIgnoringModifiers()) };
let modifiers = unsafe { key_modifiers(nsevent.modifierFlags()) };
eprintln!(
"key_common ENTER (down={} chars={:?} unmod={:?} modifiers={:?}",
key_is_down, chars, unmod, modifiers
);
if modifiers.is_empty() && key_is_down {
unsafe {
let input_context: id = msg_send![this, inputContext];
@@ -861,6 +857,10 @@ impl WindowView {
repeat_count: 1,
key_is_down,
};
eprintln!(
"key_common {:?} (chars={:?} unmod={:?} modifiers={:?}",
event, chars, unmod, modifiers
);
if let Some(myself) = Self::get_this(this) {
let mut inner = myself.inner.borrow_mut();