Fixing the display of history in terminal.app

Once I started using leopard's new shiny terminal I noticed some problems with the terminal whenever I was using the cursor keys to access items in the memory.

What happens is the lines of history appear to start halfway through a previous line of history like so:

For a while I've been blaming the terminal when in fact it was totally my fault. The problem occurs when you have incorrectly escaped your prompt.

The details of the correct color escape sequence can be found at tdlp.org

Once I'd corrected my escaping the problem was fixed and now history works as expected. What's interesting is that I've been using the same prompt for ages on Tiger and had never had that problem although for the best part of a year I have been using iTerm, and I'm not sure if there's something about tiger's terminal or iTerm that makes it more forgiving of dodgy escape sequences.

Show Comments