Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
terminal not clearing the line when scrolling past commands
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 13, 2018 8:24 pm    Post subject: terminal not clearing the line when scrolling past commands Reply with quote

Hello Gentoo people

I have ubuntu on laptop, and i have several rpi's and on my main box i have gentoo.
I believe it is my bad english that produced no answer searching the internet so I thought i might ask for help here.
I have 2 terminals, xterm and st, on gentoo. As i use up arrow button to get past commands it does not cleas some commands.
It is hard to explain so i made a very short video, it happens at 10 seconds
https://www.youtube.com/watch?v=kqJn0ajsfZw
This happens only on gentoo.
Is there something i can do?

Thank you
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9711
Location: almost Mile High in the USA

PostPosted: Tue Nov 13, 2018 9:41 pm    Post subject: Reply with quote

I noticed that you have color in your text and it differs than of your prompt. Perhaps your PS1 prompt doesn't have all the codes needed to tell bash what to clear. If you clear PS1 to something very simple like PS1='$ ' can you reproduce the problem?

Or perhaps something in your history has some control codes that is confusing bash. From a clean environment (i.e. no history), is this readily reproducable?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 13, 2018 11:51 pm    Post subject: Reply with quote

Hello eccerr0r,

You are right on the point, it is PS1
with PS1='$ ' i could not reproduce the problem (xterm or st). my PS1 is
PS1='\e[0;32m\]\u@\h \w \$\e[0m\] '
and i copy & pasted that from some colourful online bashrc.

Thank you, i will now look for correct PS syntax
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9711
Location: almost Mile High in the USA

PostPosted: Wed Nov 14, 2018 12:01 am    Post subject: Reply with quote

I'd try this
Code:
PS1='\[\e[0;32m\]\u@\h \w \$\[\e[0m\] '

_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Wed Nov 14, 2018 12:36 am    Post subject: Reply with quote

hey eccerr0r,

yes i see i have some 'brackets' missing, i found this page:
https://www.ibm.com/developerworks/linux/library/l-tip-prompt/
and came up with this:
Code:
PS1='\[\e[36;1m\]\u\[\e[33;1m\]@\[\e[36;1m\]\h \[\e[32;1m\]\w \[\e[36;1m\]\$ \[\e[31;1m\]> \[\e[0m\]'


Again, thank you for your time and input, man, sure did lift the stone from my hart, <3
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Wed Nov 14, 2018 11:09 pm    Post subject: Reply with quote

while true wrote:
my PS1 is
PS1='\e[0;32m\]\u@\h \w \$\e[0m\] '

what eccerr0r said. you have to enclose non-printing characters within \[ and \]
thus your above prompt should be
Code:
PS1='\[\e[0;32m\]\u@\h \w \$\[\e[0m\] '

you are terminating them ok but without starting

http://nixventure.blogspot.com/2018/10/shell-in-colours.html
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum