On 2023-01-26 13:09:31 -0500, Greg Wooledge wrote: > On Thu, Jan 26, 2023 at 06:34:24PM +0100, Vincent Lefevre wrote: > > About this, Ctrl-U is just a shell feature. Contrary to bash, it is > > not really usable in zsh to erase long pastes (unless one changes > > the default bindings). But Ctrl-C is fine in zsh. > > Ctrl-U is bound to "kill" at the terminal level (e.g. stty(1)). It's > more than just a shell feature. You can use it in any setting where > a terminal is in "canonical mode", e.g. "cat" with no arguments reading > from a terminal, or a terminal's login prompt.
Shells do not use "canonical mode". In zsh, Ctrl-U is handled by zle, bash uses readline, AFAIK, so that it depends on the Ctrl-U binding. See examples in the readline(3readline) man page. > I don't know a lot about zsh, but I ran it, typed some letters, and > pressed Ctrl-U, and they were all erased as expected. But the point is multiline, as you did then: > One difference that I did notice in zsh is that its handling of Ctrl-U > after a bracketed paste is different from bash's. I used "seq 3 | xclip -i" > to load three harmless lines into the paste selection, and then pasted > it into zsh, and into bash, and pressed Ctrl-U in each of them. In the > zsh case, only the third line was erased, and the first 2 were still > there, and were executed when I pressed Enter. In bash, all 3 lines > were erased, and Enter didn't execute any of them. > > Whether that's a bug in zsh, I can't say. I would say that's expected and this is actually a bug in bash: "kill-whole-line" means to kill the line, not the whole text. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)