<p>Using Terminal.app 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.  </p>

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

<p>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. </p>

<p><a href="http://involution.com/images/osxterminal.png">os x terminal failure image http://involution.com/images/osxterminal.png</a></p>

<p>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. </p>

[{'answer_id': 35573, 'author': 'dF.', 'author_id': 3002, 'author_profile': 'https://Stackoverflow.com/users/3002', 'pm_score': 1, 'selected': False, 'text': "<p>I can't reproduce this, hitting either <kbd>Ctrl</kbd>+<kbd>E</kbd>, <kbd>Ctrl</kbd>+<kbd>A</kbd> or the arrow keys updates the command line correctly. Are you running 10.5.4? Is it perhaps a bug in earlier versions?</p>\n"}, {'answer_id': 35588, 'author': 'John Millikin', 'author_id': 3560, 'author_profile': 'https://Stackoverflow.com/users/3560', 'pm_score': 1, 'selected': False, 'text': "<p>I've encountered this bug, and while I don't know how to solve it, you can work around it by pressing <code>&lt;down&gt;&lt;up&gt;</code></p>\n"}, {'answer_id': 157259, 'author': 'Milhous', 'author_id': 17712, 'author_profile': 'https://Stackoverflow.com/users/17712', 'pm_score': 2, 'selected': False, 'text': '<p>You may want to look at this post.</p>\n\n<p><a href="https://stackoverflow.com/questions/105349/bash-prompt-in-os-x-terminal-broken">bash-prompt-in-os-x-terminal-broken</a></p>\n\n<p>I had the same problem and it had to do with the PS1 variable.  Let me know if this helps.</p>\n'}, {'answer_id': 157582, 'author': 'Mark Baker', 'author_id': 11815, 'author_profile': 'https://Stackoverflow.com/users/11815', 'pm_score': 1, 'selected': False, 'text': "<p>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.</p>\n\n<p>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.</p>\n\n<p>Solution in this case is to resize the window again so that bash gets the signal and notices the new size.</p>\n"}, {'answer_id': 464168, 'author': 'Jason Haslup', 'author_id': 57383, 'author_profile': 'https://Stackoverflow.com/users/57383', 'pm_score': 5, 'selected': True, 'text': '<p>I was able to set my TERM to xterm instead of xterm-color and it solves the problem.  (export TERM=xterm).</p>\n'}, {'answer_id': 766583, 'author': 'Joshua', 'author_id': 14768, 'author_profile': 'https://Stackoverflow.com/users/14768', 'pm_score': 0, 'selected': False, 'text': '<p>In worst case, you could launch the X server (somewhere under utilities) and launch a real xterm. </p>\n'}, {'answer_id': 1385821, 'author': 'Adagios', 'author_id': 169280, 'author_profile': 'https://Stackoverflow.com/users/169280', 'pm_score': 2, 'selected': False, 'text': '<p>If the prompt has colors, then this is an acknowledged bug.<br>\nSee <a href="http://osdir.com/ml/bug-bash-gnu/2009-07/msg00019.html" rel="nofollow noreferrer">bug report <em>msg#00019</em></a>.</p>\n'}]
['https://Stackoverflow.com/questions/35563', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3499/']