tags:

views:

242

answers:

2

I know that I can highlight text and its automatically copied, but is there a way to delete the text that you highlight? I am using nano.

A: 

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.

Matt
Not completely true -- the **terminal** often does know what the mouse is doing. But programs that interface with the terminal (like nano in this case) don't.
Daniel Pryden
+3  A: 

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.)

Daniel Pryden