] $ ls -1 nonexistent >> /tmp/rat/ant.mdj
[tester::#UN3 ] ^ Line does not match expected value.
[tester::#UN3 ] Expected: “$ ls -1 nonexistent >> /tmp/rat/ant.md”
[tester::#UN3 ] Received: “$ ls -1 nonexistent >> /tmp/rat/ant.mdj”
[tester::#UN3 ] Assertion failed.
[tester::#UN3 ] Test failed
this is the error i got , everything is fine , after a lot of debuggig i am unable to spot the exact bug
Hey @harshitneversettle , could you take a look at your key parsing logic around the ENTER key?
In some languages, ENTER is treated as Alt+J Ctrl+J instead of \n, which can lead to a stray j showing up in the input.
Thanks for addressing my question andy1li
this is my Enter logic
according to me , the bug is is due to the raw mode enabled , but somehow i am unable to find that
1 Like
@harshitneversettle Thanks for sharing the screenshot! Could you try handling Ctrl+J the same way as Enter?
In crossterm , newline (0xA) is mapped to Ctrl+J in raw mode:
event
}
})
}),
}
}
}
b'\r' => Ok(Some(InternalEvent::Event(Event::Key(
KeyCode::Enter.into(),
)))),
// Issue #371: \n = 0xA, which is also the keycode for Ctrl+J. The only reason we get
// newlines as input is because the terminal converts \r into \n for us. When we
// enter raw mode, we disable that, so \n no longer has any meaning - it's better to
// use Ctrl+J. Waiting to handle it here means it gets picked up later
b'\n' if !crate::terminal::sys::is_raw_mode_enabled() => Ok(Some(InternalEvent::Event(
Event::Key(KeyCode::Enter.into()),
))),
b'\t' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Tab.into())))),
b'\x7F' => Ok(Some(InternalEvent::Event(Event::Key(
KeyCode::Backspace.into(),
)))),
// newlines as input is because the terminal converts \r into \n for us. When we
// enter raw mode, we disable that, so \n no longer has any meaning - it's better to
// use Ctrl+J. Waiting to handle it here means it gets picked up later
b'\n' if !crate::terminal::sys::is_raw_mode_enabled() => Ok(Some(InternalEvent::Event(
Event::Key(KeyCode::Enter.into()),
))),
b'\t' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Tab.into())))),
b'\x7F' => Ok(Some(InternalEvent::Event(Event::Key(
KeyCode::Backspace.into(),
)))),
c @ b'\x01'..=b'\x1A' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char((c - 0x1 + b'a') as char),
KeyModifiers::CONTROL,
))))),
c @ b'\x1C'..=b'\x1F' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char((c - 0x1C + b'4') as char),
KeyModifiers::CONTROL,
))))),
b'\0' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char(' '),
KeyModifiers::CONTROL,
cool , i will definitely go through it ,
is there any way i can connect with you , for me , it is my x : https://x.com/Harshit_yad4v
would love to connect
1 Like
system
Closed
January 27, 2026, 9:55am
7
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.