Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
long commands overwrite themselves
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
r.j.hall
n00b
n00b


Joined: 06 Feb 2003
Posts: 53
Location: London

PostPosted: Wed Jun 23, 2004 4:49 pm    Post subject: long commands overwrite themselves Reply with quote

why is it that sometimes in my konsole if I am typing a long command it doesn't linefeed correctly, instead it seems to start overwriting itself and moves the whole lot up one line also overwriting the previous line. If I try and go back in the command and edit it, even stranger things start happening.

Is this a common problem?
Is there an easy solution to prevent it?

Thanks
Rich
_________________
--- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
You've read it.
You can't unread it!
--- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Back to top
View user's profile Send private message
Tyir
Apprentice
Apprentice


Joined: 08 Mar 2004
Posts: 172
Location: Montreal

PostPosted: Wed Jun 23, 2004 5:05 pm    Post subject: Reply with quote

no idea how to prevent it, but i get it sometimes too!
_________________
There are two things I have learnt in life:
1. Don't reveal everything you know.
Back to top
View user's profile Send private message
Useful Idiot
Guru
Guru


Joined: 30 Aug 2002
Posts: 329
Location: Finland

PostPosted: Wed Jun 23, 2004 5:12 pm    Post subject: Reply with quote

Does this happen after you have resized konsole window? If it does add
Code:
shopt -s checkwinsize

to your .bashrc.
_________________
[size=9]We are all in the gutter, but some of us are looking at the stars.
Back to top
View user's profile Send private message
Zyne
Guru
Guru


Joined: 08 Jun 2004
Posts: 334

PostPosted: Wed Jun 23, 2004 5:19 pm    Post subject: Reply with quote

lol... I'm getting this too from time to time... Really weird.
it happens mostly if it's the last line you're writing. The text above doesn't seem to move up anymore... :/

I'm gonna try Useful Idiot's solution, and see what that gives me.
btw this happens to me in aterm, and the only solution is to close aterm, and start a new console.
Back to top
View user's profile Send private message
sapphirecat
Guru
Guru


Joined: 15 Jan 2003
Posts: 376

PostPosted: Wed Jun 23, 2004 8:19 pm    Post subject: Reply with quote

I've seen this happen in screen+xterm, especially with less, in which case a ^A ^L restores it. (I can't remember offhand if any resizing was involved, though...) If you're not using screen, hitting ^L from the shell prompt may help, although it will clear the screen as well.
_________________
Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%...
Back to top
View user's profile Send private message
Slack006
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2003
Posts: 97
Location: Desert of AZ

PostPosted: Sat Jun 26, 2004 7:12 pm    Post subject: Reply with quote

I had this same thing happen to me... Are you using color codes in your prompt? That was my issue.

:oops: I wish I could give you the exacts, but I am stuck at work and unable to get to my machine. The gist of it was I didn't properly escape my color codes. (Extra brackets needed, or a missing backslash or some such crap). Message me back if you don't get it figured out. To test, take the color codes out of your PS1 and see if the issue goes away. I'll post my shell color codes when I get home if you need them. :)
_________________
Slack

May the SOURCE be with you...
Back to top
View user's profile Send private message
phranzee
Guru
Guru


Joined: 22 Nov 2003
Posts: 397
Location: katowice/pl

PostPosted: Sat Jun 26, 2004 7:15 pm    Post subject: Reply with quote

every color declaration in your prompt should look like this:
Code:
\[\033[01;34m\]

\[COLOR\] - that's all ;)
_________________
signature fault
post dumped ;]
Back to top
View user's profile Send private message
Slack006
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2003
Posts: 97
Location: Desert of AZ

PostPosted: Sat Jun 26, 2004 7:18 pm    Post subject: Reply with quote

Exactly. :) That's where I was screwing up. Basically, if you don't properly escape the code, then the shell doesn't know exactly how long your prompt is (chars), and thus doesn't know when to wrap...
_________________
Slack

May the SOURCE be with you...
Back to top
View user's profile Send private message
InfinityX
Guru
Guru


Joined: 31 Jan 2004
Posts: 385

PostPosted: Sat Jun 26, 2004 8:36 pm    Post subject: Reply with quote

So is there something wrong with this one?

Code:
PS1="\[\033[0;31m\]\u@\[\033[0;31m\]\h \[\033[0;34m\]\W # \[\033[0m\]"


I get the wrapping problem but it looks like I've closed them all :?
Back to top
View user's profile Send private message
Slack006
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2003
Posts: 97
Location: Desert of AZ

PostPosted: Sat Jun 26, 2004 8:43 pm    Post subject: Reply with quote

I don't see anything wrong with it... However, here's what I use in my .bashrc..

Code:

# Color Variables
black='\[\e[0;30m\]'
BLACK='\[\e[1;30m\]'
red='\[\e[0;31m\]'
RED='\[\e[1;31m\]'
green='\[\e[0;32m\]'
GREEN='\[\e[1;32m\]'
yellow='\[\e[0;33m\]'
YELLOW='\[\e[1;33m\]'
blue='\[\e[0;34m\]'
BLUE='\[\e[1;34m\]'
magenta='\[\e[0;35m\]'
MAGENTA='\[\e[1;35m\]'
cyan='\[\e[0;36m\]'
CYAN='\[\e[1;36m\]'
white='\[\e[0;37m\]'
WHITE='\[\e[1;38m\]'
NC='\[\e[0m\]'

# Prompt Settings
PS1=$GREEN'\u@\h:[\w]\$'$NC' '

_________________
Slack

May the SOURCE be with you...
Back to top
View user's profile Send private message
gnuageux
Veteran
Veteran


Joined: 17 Apr 2004
Posts: 1201

PostPosted: Fri Jul 02, 2004 8:49 am    Post subject: Reply with quote

I like:


export PS1='\[\e[32m\]\u@\h \[\e[1;31m\]\w\[\e[1;34m\]\$\[\e[0m\] '
_________________
The realOTW: http://forums.realotw.org/index.php

Registered Linux user#364538
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Sun Aug 08, 2004 8:53 am    Post subject: Reply with quote

Erm... I don't get it. I'm a complete n00b with fixing bash. It always just worked before.

Can someone explain what it is I have to do? Do I have to edit some kind of configuration script for bash somewhere - and if so which one and how?

This is a deeply annoying problem, as bash is something I use pretty much all the time in Linux. It would be very tough to have to live without it.

GJ
Back to top
View user's profile Send private message
sf_alpha
Tux's lil' helper
Tux's lil' helper


Joined: 19 Sep 2002
Posts: 136
Location: Bangkok, TH

PostPosted: Sun Aug 08, 2004 10:57 pm    Post subject: Reply with quote

It cause by curses based program terminate uncorrectly.

try

echo -n -e '\033c'

(Terminal Reset)

I think it not work all time but my Linux console.
_________________
Gentoo Mirrors in Thailand (and AP)
http://gentoo.in.th
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Sun Aug 08, 2004 11:32 pm    Post subject: Reply with quote

No it didn't work for me. I'm embarrased to say I don't even quite understand what these guys are talking about. I wish someone would explain it to me.

GJ
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Tue Aug 10, 2004 12:02 pm    Post subject: Reply with quote

Bump... Guys please be nice and explain how to do this.

Thanks....

GJ
Back to top
View user's profile Send private message
conchyliferous
n00b
n00b


Joined: 28 May 2005
Posts: 50
Location: Sweden

PostPosted: Thu Feb 23, 2006 8:03 am    Post subject: What's wrong with bash? Reply with quote

Got a problem with bash. It doesn't change line like it should. When the input fills up the terminal the first time and it should change line it doesn't. The input just starts to the left again and "eats up" that line. When it comes to the end of the terminal again it changes line like it should. :?
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Thu Feb 23, 2006 8:09 am    Post subject: Reply with quote

Is this in an xterm, or text console?

In xterm, Bash sometimes assumes wrong window sizes and breaks too early / too late (happens when you resize/maximize your window while Bash is not currently active). Resizing the window again while in bash prompt fixes this problem.

Also, Bash may get flakey when you print binary data to stdout... in that case, 'clear' and 'reset' may fix the problem.


Last edited by frostschutz on Thu Feb 23, 2006 8:10 am; edited 1 time in total
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Thu Feb 23, 2006 8:09 am    Post subject: Reply with quote

can you post the out put of
Code:
 echo $PS1

_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
fangorn
Veteran
Veteran


Joined: 31 Jul 2004
Posts: 1886

PostPosted: Thu Feb 23, 2006 8:22 am    Post subject: Reply with quote

I know this behaviour from xterm. There exists a variable "XTerm*autoWrap: true" that does automatically use a new line at the end.

Edit:
should really answer directly, not after some minutes :roll:
_________________
Video Encoding scripts collection | Project page
Back to top
View user's profile Send private message
conchyliferous
n00b
n00b


Joined: 28 May 2005
Posts: 50
Location: Sweden

PostPosted: Mon Feb 27, 2006 8:15 am    Post subject: Reply with quote

Sorry for the late reply.
I'm using urxvt and I know that resizing can mess things up sometimes but it ain't that easy this time I'm afraid.

My PS1 follows here:
Code:
\e[32m\u \e[36m& \w\e[0m


I tried out xterm with the autowrap option enabled. But that didn't help.

Thanks for helping me, appreciated. :)
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Mon Feb 27, 2006 1:35 pm    Post subject: Reply with quote

Merged from here.
_________________
Search | Read | Answer | Report | Strip
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