How to delete highlighted text in a ssh terminal?
I know that I can highlight text and its aut开发者_StackOverflow社区omatically copied, but is there a way to delete the text that you highlight? I am using nano.
Assuming you're using PuTTY on Windows, here is the way the applications are stacked:
You -> Windows -> PuTTY -> SSH protocol -> sshd -> Unix pty -> nano -> filesystem
PuTTY talks to Windows, so it knows about your mouse. And it can do things like interact with the Windows clipboard. On the other hand, nano isn't even running on your computer, it's running on the remote computer. So it doesn't know anything about your mouse or your Windows clipboard. It only knows about what it can talk to through a tty device (usually a pty, or "pseudo-terminal" device).
When you're running nano locally (on a Unix desktop, in xterm or something similar), nano talks to xterm, and can get mouse information from the terminal (if mouse support is enabled in nano).
To get mouse support in nano, try using nano -m
, or put "set mouse" in your ~/.nanorc
. You may want to browse the nano documentation for more information. Additionally, you may need to do export TERM=xterm
or similar in your shell if PuTTY isn't in your termcap file.
With mouse support on, nano will use xterm-compatible terminal extensions to talk through SSH to PuTTY. Then you will be able to cut and paste (and delete text) in nano, but you won't be able to cut and paste text with the Windows clipboard anymore. (If you want the old behavior back, you can hold down shift while you select. See the PuTTY documentation for details.)
Ususally, no. The issue is that the terminal doesn't have any knowledge of the mouse and what the mouse highlights - it's very low level. In other terms, the mouse sits on a "higher layer" than the terminal; nothing the mouse does is known to the terminal.
精彩评论