Wandering Thoughts archives


Making large selections in xterm (and urxvt and Gnome Terminal)

Suppose that you have a large chunk of output in a terminal window, specifically more than a full screen's worth, and you want to copy it into an email message, text file, or however else you may be logging it for the record. As I knew vaguely but had never really read up on or used until very recently, it turns out that there is a convenient way to do this in xterm. Specifically, this is what the right mouse button is for; it extends the selection from where it is until the current point.

So in xterm what you do to select a huge selection is select a bit right at one end (the start or the end), scroll to the other end, and carefully hit the right mouse button at where you want the selection to end. The selection is instantly extended. You can do this several times if you want, extending the selection each time. Odder and less easily controlled things happen if you hit the right mouse button somewhere inside the selection.

This doesn't work in Gnome Terminal. Instead what you have to do is start the selection with the left mouse button and while making it, drag the mouse cursor to the edge of the window (or outside the window). G-T will scroll things for you, extending the selection in the process. G-T's scrolling is sufficiently rapid that this is a reasonably convenient and intuitive process, arguably better than xterm's.

Urxvt gives you both options; you can extend the selection explicitly with the right mouse button or let urxvt scroll things for you in the same way as Gnome Terminal. The one drawback is that urxvt by default scrolls inconveniently slowly (and there doesn't seem to be any way to control this from what I can see in the manual). You can scroll with a mouse scrollwheel and it works reasonably well although a bit jumpily in my quick test.

(Xterm doesn't scroll at all if you drag the mouse out of the window while you make a selection.)

In a brief test, KDE's Konsole works the same way as Gnome Terminal. I suspect that this is going to be the common behavior of more or less all modern 'smart' terminal emulators because it makes the most sense and it's relatively discoverable (unlike the right mouse button in xterm).

unix/XTermLargeSelections written at 01:55:04; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.