+1  A: 

I can't reproduce this, hitting either Ctrl+E, Ctrl+A or the arrow keys updates the command line correctly. Are you running 10.5.4? Is it perhaps a bug in earlier versions?

dF
This has been happening since Tiger for me.
hoyhoy
A: 

I've encountered this bug, and while I don't know how to solve it, you can work around it by pressing <down><up>

John Millikin
Down/up works. So theoretically you could search, then hit down, then up, then ctrl-e. But I'm looking for some elite termcap or readline patch to solve this.
hoyhoy
A: 

Does iTerm handle this properly? That might help narrow down the source of the problem.

Hank Gay
Not sure, I haven't tried iTerm.
hoyhoy
+4  A: 

You may want to look at this post.

bash-prompt-in-os-x-terminal-broken

I had the same problem and it had to do with the PS1 variable. Let me know if this helps.

Milhous
+1  A: 

Not sure whether this is the problem here, but a very common cause of a messed up screen in bash (with any terminal emulator, not just Terminal.app) is the window being resized.

Bash will read the window size when it starts up, and then assume it hasn't changed. When the window is resized a signal will be sent to whatever app is currently reading from the console. If this isn't bash (because you're running a text editor at the time, perhaps), then bash won't know about it.

Solution in this case is to resize the window again so that bash gets the signal and notices the new size.

Mark Baker
+6  A: 

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

Jason Haslup
Just got around to trying this, and it works!
hoyhoy
A: 

I'm on 10.5.6 and get the same problem. It happens even when I hit enter instead of ctl-e to exit the reverse search, and even when I use up-arrow to walk commands in reverse. Setting my TERM variable to xterm doesn't help.

The problem still exists on 10.6.1 as well.
hoyhoy
A: 

In worst case, you could launch the X server (somewhere under utilities) and launch a real xterm.

Joshua
A: 

I have the same issue, when I hit Enter to choose a reverse-i-search command it screw up the output and I have to close the whole application (not just tabs, I need to cmd+q). It's very annoying, anyone found a solution?

Note: with X11 or iTerm the issue disappears, all work as expected! The problem must be somewhere in Terminal application.

A: 

I also have this problem, but only if the prompt has colors.

I think this might explain it: http://osdir.com/ml/bug-bash-gnu/2009-07/msg00019.html