Opened 2 years ago
Closed 2 years ago
#18029 closed bug (fixed)
Pasting into nano etc. eats newlines and indentation
Reported by: | humdinger | Owned by: | jessicah |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | Applications/Terminal | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
This is hrev56563.
If I copy&paste something from a GUI editor like StyledEdit into an editor runnning in Terminal, like nano or ne, the newlines (CR? LF?) and tabs don't make it. For nano, the width of the Terminal window seems to determine where a line ends most times, it appears.
This block:
# Get optional 'action' options="clean debug catkeys help h -h --h --help" for item in $options ; do for opt in "$@" ; do if [ "$opt" = "$item" ] ; then action="$opt" break fi done done
becomes pasted in nano:
# Get optional 'action' options="clean debug catkeys help h -h --h --help" for item in $options ; do for opt in "$@" ; do if [ "$opt" = "$item" ] ; then action="$opt" break fi done done
"ne", the 'nice editor' seems to interpret the first CR/LF(?) as some sort of command or something (not a big user of "ne" yet...), and jumps into a sort of input line at the bottom.
I did a quick check, it works as expected under linux.
[Not sure about the category for this ticket...]
Change History (5)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Good call! In "ne"s case CRTL+J is a "jump to line", which pops the cursor to the bottom of the screen where it expects the line number to jump to.
comment:3 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Bracketed paste needs to be implemented for nano (and maybe others) for correct paste behaviour.
https://git.savannah.gnu.org/cgit/nano.git/tree/src/nano.c#n1226
https://www.xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode
comment:5 by , 2 years ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Merged in hrev56695
Works in 'vim' in the same terminal.
I haven't tried 'ne', but the 'nano' case seems to be a keybinding clashing of some type. Looking in help, Ctrl-J (which in a terminal is the LF code) justifies the paragraph, and after pasting a [ Justified paragraph ] message is shown in the status line. The same effect as if you typed the text and pressed Ctrl-J. Like there's no distinction between recieving a key press and pasting its code. Whether that's a problem in the app, the terminal description or ncurses, I can't tell.