Skip to content

Trouble with the terminal wrapping lines

I'm having trouble with gnome terminal wrapping long lines when it doesn't need to. I've googled this problem, but haven't come up with any solutions. I'm hoping you guys can help me out. Here's a video of the bug in action:

Gnome Terminal wrapping bug

My PS1

PS1='[\u@\h \W] $(__git_ps1 "(%s)")\$ '

Update, I've tried it without the __git_ps1 in there too.

Much appreciated.

9 points7 comments
Open on Reddit
About this post
Posted
Archived
Score
9 · 100% up
Kind
Text
ID
mp3md

Author

26
posts
352
comments
3
media
View profile

7 comments

forum link

It's a problem with bash making you wrap non printing characters with "\ [" and "\ ]" (without the spaces - reddit seems to not like those characters).

My PS1: '[\e[0;32m]\u($('gmailcount')) [\e[m\e[0;31m][\A][\e[m] [\e[1;34m]\w[\e[m] [\e[1;32m$\e[m] '

I can't remember much about it, aside from the fact that it did what I wanted it to. I built a gaming desktop, and went back to Windows for Steam.

3 points

I can't remember much about it

That is probably the norm. :-)

1 points

Two common issues with terminal wrapping:

  1. Make sure you're properly escaping the non-printable characters. Doesn't seem to be the entire issue here, since you don't have a lot of escape sequences, but it's an issue with some PS1s found online (and the one included in early editions of Archbang). tenmilestereo has more details on it.
  2. Sometimes the column/row values of the terminal aren't properly set when you resize. It depends on the terminal. Try using stty to reset the columns.
2 points

can you please elaborate on what you did to solve this? i have run into this same bug and it drives me insane.

0 points

Someone said it was caused by the PS1 so I looked at that first, but saw nothing wrong with it. Then I went through my ~/.bashrc file to see what custom stuff I had added and commented out things one by one. After each iteration I ran reset in my terminal, closed it and then reopened it. The cause of my problem was down to the completion script added by npm (node package manager).

I experienced the problem again, not sure what it is now :-(

1 points

As opposed to resetting, you can just type "source ~/.bashrc" if you want to load that file into your terminal. Just a thought for next time. :)

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.