Yay for rectangular selection! (But just this once)

August 21, 2007

I’m usually annoyed by the fact that the Windows terminal application uses rectangular selection, rather than the standard line-based selection. The problem I normally run into is when I try to cut and paste a line that wraps in the terminal window:

Rectangular selection example

So you end up with a bunch of extra line breaks in the text when you paste it. I see how this could be useful if you are cutting and pasting columns of text, but I personally find that it happens so rarely that it’s not worth the pain that rectangular selection causes me most of the time.

But — JOY! — I’ve found a cool scenario where it does work really well for me. When I’m doing Python development (have I mentioned that I’m in love with Python these days?), I keep two terminal windows open: one for launching my application, and another one which is running the Python console, which I use as a sandbox to quickly test out snippets of code. It turns out that rectangular selection comes in really handy for moving working code from the Python console into my text editor, like this:

Selecting text in the Python console

The rectangular selection turns out to be a handy way to omit the “>>>” that begins every line in the Python console. I still have a problem with line breaks, but luckily Python code rarely runs over 80 characters. Now if only there were a way to get it to automatically ignore the syntax errors…