feat: [rust] support kill line keyboard shortcut
Resolved 💬 5 comments Opened Jun 27, 2025 by joshka Closed Aug 12, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator)
responded on this thread — see the highlighted reply below.
In command line apps, generally Ctrl+U should delete the current line.
This assumes compatibility with readline / emacs bindings which are the default expectations on many unix variants.
This currently deletes the previous character. I'm assuming it's probably acting as an undo command.
Ctrl+K seems to work however.
5 Comments
ctrl+K works as well as ctrl+U
Ctrl+K kills from the cursor location until the end of line. It's useless when you're at the end of a line (where I'm most commonly deciding to use it).
https://web.mit.edu/gnu/doc/html/rlman_1.html#SEC15 for the ref btw.
@joshka while my expectations for
ctrl+uare the same as yours, FYI, we are currently inheriting these keyboard shortcuts from tui-textarea:https://docs.rs/tui-textarea/latest/tui_textarea/index.html
It appears they map it to Undo by default?
Ah got it. I didn't dig into the implementation too much on this. It's part of a deeper issue about how keyboard shortcuts should work in TUI apps. There's some discussion about it over in https://github.com/rhysd/tui-textarea/issues/51
At a high level, I think from an app perspective TUI apps should do the canonical non-surprising thing by default (i.e. use readline / emacs shortcuts at least on unix-like OSes), and they should have config options to modify this behavior if appropriate.
Since the latest version enables ctrl+u, let us close this one now.