How Do I Make Bash Reverse-search Work In Without It Displaying Garbled Output?

- 1 answer

Using on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoying.

Steps to reproduce: Open, reverse-search to a longish command. Hit <ctrl>-E once you've found the command. The cursor goes to the end of the line, but the display doesn't update.

I'm guessing this is some kind of problem with the readline library on OS X. It's more of a problem with updating the cursor position after a search than anything else. Basically, ctrl-a and ctrl-e tend to break the search output.

os x terminal failure image

In the above, the first part of the command should be displayed, and the cursor should be at the end of the line, but it isn't. You literally can't see what you're editing when this happens.



I was able to set my TERM to xterm instead of xterm-color and it solves the problem. (export TERM=xterm).