Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X Terminal text stacking on top of itself

I'm encountering a strange issue in the Terminal app in Mac OS X Lion. When I enter in a long line of text that should wrap to the next line when it reaches the edge of the Terminal window, it continues to type on top of the text from the line above it.

Here are some screenshots to help illustrate the issue:

Before my text reaches the window edge:

before

After the text reaches the window edge:

after

I've also supplied screenshots of my text and window settings in case those might be helpful.

Text settings:

text

Window settings:

window

Thanks in advance for any assistance offered. I've had this issue for a while and just never got around to it. It's now really becoming a pain in the ass when I get into things that require big grep commands and long path names.

like image 763
Daryn Avatar asked Aug 06 '12 15:08

Daryn


People also ask

How do I keep terminal on top Mac?

Restart your machine. When you log back in, open the Afloat app. From there, go to the window options and click “Keep Afloat” within the list. This process should give you the Keep Afloat option for some of your applications.

How do you scroll up and down on a Mac terminal?

You can scroll the screen while holding fn or Shift ⇧ key. You can disable this completely by unticking: Terminal Preferences → Profiles → Keyboard → Scroll Alternate Screen.


1 Answers

PS1 environment variable determines what shell's prompt will look like. man bash gives full documentation on it. (There are actually several of them, for different modes).

There are number of files that may be setting it, usually one of ~/.profile, ~/.bashrc, /etc/profile or /etc/bashrc.

If you're going to have color codes or other control sequences inside it, you must wrap them with \[ and \] properly (and NOT wrap normal text), otherwise line editing may become messed up like in your case. I suggest resetting PS1 to the default value then carefully adding coloring back item by item.

For example:

PS1='\[\033[1m\033[32m\]\u@\h \w\[\033[0m\]\$ '        ^^^^^^^^^^^^^^^            ^^^^^^^ 

Coloring commands are underlined. Note how they are surrounded with \[ \].

like image 83
hamstergene Avatar answered Nov 10 '22 02:11

hamstergene