Terminal prompt overwrites current line

Clash Royale CLAN TAG#URR8PPP
I have an issue with my terminal prompt line. When the line is too long it wraps on the same line and then Up arrow makes it look even worse.
I have already checked Terminal prompt not wrapping correctly,
but it looks like I am apparently closing all the squared brackets for non printable characters.
This is my PS1:
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [33[01;36m]u@h[33[00m]33[01;34m]w33[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]
Consider this as my standard prompt line
MELISC@work~/dev/bin_tools[((main))]
I was able to get
assdasdasdasdasdadasdsadadasdaddasdadadasdadsadasdsa((main))] asdsadsadsadsadasdasdassdasdasdassdasdassdasdasdasdasdasdasdsadsad
I have already checked my .bashrc
I have and shopt -s checkwinsize should autocheck the columns
bash shell prompt bashrc
add a comment |
I have an issue with my terminal prompt line. When the line is too long it wraps on the same line and then Up arrow makes it look even worse.
I have already checked Terminal prompt not wrapping correctly,
but it looks like I am apparently closing all the squared brackets for non printable characters.
This is my PS1:
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [33[01;36m]u@h[33[00m]33[01;34m]w33[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]
Consider this as my standard prompt line
MELISC@work~/dev/bin_tools[((main))]
I was able to get
assdasdasdasdasdadasdsadadasdaddasdadadasdadsadasdsa((main))] asdsadsadsadsadasdasdassdasdasdassdasdassdasdasdasdasdasdasdsadsad
I have already checked my .bashrc
I have and shopt -s checkwinsize should autocheck the columns
bash shell prompt bashrc
add a comment |
I have an issue with my terminal prompt line. When the line is too long it wraps on the same line and then Up arrow makes it look even worse.
I have already checked Terminal prompt not wrapping correctly,
but it looks like I am apparently closing all the squared brackets for non printable characters.
This is my PS1:
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [33[01;36m]u@h[33[00m]33[01;34m]w33[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]
Consider this as my standard prompt line
MELISC@work~/dev/bin_tools[((main))]
I was able to get
assdasdasdasdasdadasdsadadasdaddasdadadasdadsadasdsa((main))] asdsadsadsadsadasdasdassdasdasdassdasdassdasdasdasdasdasdasdsadsad
I have already checked my .bashrc
I have and shopt -s checkwinsize should autocheck the columns
bash shell prompt bashrc
I have an issue with my terminal prompt line. When the line is too long it wraps on the same line and then Up arrow makes it look even worse.
I have already checked Terminal prompt not wrapping correctly,
but it looks like I am apparently closing all the squared brackets for non printable characters.
This is my PS1:
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [33[01;36m]u@h[33[00m]33[01;34m]w33[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]
Consider this as my standard prompt line
MELISC@work~/dev/bin_tools[((main))]
I was able to get
assdasdasdasdasdadasdsadadasdaddasdadadasdadsadasdsa((main))] asdsadsadsadsadasdasdassdasdasdassdasdassdasdasdasdasdasdasdsadsad
I have already checked my .bashrc
I have and shopt -s checkwinsize should autocheck the columns
bash shell prompt bashrc
bash shell prompt bashrc
edited Apr 13 '17 at 12:36
Community♦
1
1
asked Oct 20 '16 at 15:59
melisc
335
335
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You've completely banjanxed the Bourne Again shell's idea of what's been printed and what it has to erase/rewrite as it displays command history and lets you edit the command line.
Breaking your prompt down into sections:
[e]0;u@h: wa]— non-printing characters, properly enclosed$debian_chroot:+($debian_chroot)— printing characters only, presumably[33[01;36m]— non-printing characters, properly enclosedu@h— printing characters only[33[00m]— non-printing characters, properly enclosed33[01;34m]— non-printing characters, improperly enclosed so the Bourne Again shell does not know that they arew33[00m]— an erroneous mixture of printing and non-printing characters[$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]— printing characters only, presumably
I've given this advice before, but it is general advice that applies here as well:
- Use either
eor33consistently, for your own sanity. - Make your
[and]strictly matching non-nesting pairs. - Make sure that all non-printing sequences are within
[and](and that, conversely, that all printing sequences are not).
(This is why I personally prefer the Z Shell and its alternative prompt expansion mechanism for when I want wacky coloured prompts. It knows that things like %Fgreen aren't printing sequences, without having to be told; and it also works out the correct escape sequences from terminfo, without having them hardwired.)
Thanks a lot I modified my PS1 in[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.
– melisc
Oct 21 '16 at 8:52
+1 for the use ofbanjanxed
– Jarrod Roberson
Apr 18 at 15:25
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f317734%2fterminal-prompt-overwrites-current-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You've completely banjanxed the Bourne Again shell's idea of what's been printed and what it has to erase/rewrite as it displays command history and lets you edit the command line.
Breaking your prompt down into sections:
[e]0;u@h: wa]— non-printing characters, properly enclosed$debian_chroot:+($debian_chroot)— printing characters only, presumably[33[01;36m]— non-printing characters, properly enclosedu@h— printing characters only[33[00m]— non-printing characters, properly enclosed33[01;34m]— non-printing characters, improperly enclosed so the Bourne Again shell does not know that they arew33[00m]— an erroneous mixture of printing and non-printing characters[$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]— printing characters only, presumably
I've given this advice before, but it is general advice that applies here as well:
- Use either
eor33consistently, for your own sanity. - Make your
[and]strictly matching non-nesting pairs. - Make sure that all non-printing sequences are within
[and](and that, conversely, that all printing sequences are not).
(This is why I personally prefer the Z Shell and its alternative prompt expansion mechanism for when I want wacky coloured prompts. It knows that things like %Fgreen aren't printing sequences, without having to be told; and it also works out the correct escape sequences from terminfo, without having them hardwired.)
Thanks a lot I modified my PS1 in[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.
– melisc
Oct 21 '16 at 8:52
+1 for the use ofbanjanxed
– Jarrod Roberson
Apr 18 at 15:25
add a comment |
You've completely banjanxed the Bourne Again shell's idea of what's been printed and what it has to erase/rewrite as it displays command history and lets you edit the command line.
Breaking your prompt down into sections:
[e]0;u@h: wa]— non-printing characters, properly enclosed$debian_chroot:+($debian_chroot)— printing characters only, presumably[33[01;36m]— non-printing characters, properly enclosedu@h— printing characters only[33[00m]— non-printing characters, properly enclosed33[01;34m]— non-printing characters, improperly enclosed so the Bourne Again shell does not know that they arew33[00m]— an erroneous mixture of printing and non-printing characters[$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]— printing characters only, presumably
I've given this advice before, but it is general advice that applies here as well:
- Use either
eor33consistently, for your own sanity. - Make your
[and]strictly matching non-nesting pairs. - Make sure that all non-printing sequences are within
[and](and that, conversely, that all printing sequences are not).
(This is why I personally prefer the Z Shell and its alternative prompt expansion mechanism for when I want wacky coloured prompts. It knows that things like %Fgreen aren't printing sequences, without having to be told; and it also works out the correct escape sequences from terminfo, without having them hardwired.)
Thanks a lot I modified my PS1 in[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.
– melisc
Oct 21 '16 at 8:52
+1 for the use ofbanjanxed
– Jarrod Roberson
Apr 18 at 15:25
add a comment |
You've completely banjanxed the Bourne Again shell's idea of what's been printed and what it has to erase/rewrite as it displays command history and lets you edit the command line.
Breaking your prompt down into sections:
[e]0;u@h: wa]— non-printing characters, properly enclosed$debian_chroot:+($debian_chroot)— printing characters only, presumably[33[01;36m]— non-printing characters, properly enclosedu@h— printing characters only[33[00m]— non-printing characters, properly enclosed33[01;34m]— non-printing characters, improperly enclosed so the Bourne Again shell does not know that they arew33[00m]— an erroneous mixture of printing and non-printing characters[$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]— printing characters only, presumably
I've given this advice before, but it is general advice that applies here as well:
- Use either
eor33consistently, for your own sanity. - Make your
[and]strictly matching non-nesting pairs. - Make sure that all non-printing sequences are within
[and](and that, conversely, that all printing sequences are not).
(This is why I personally prefer the Z Shell and its alternative prompt expansion mechanism for when I want wacky coloured prompts. It knows that things like %Fgreen aren't printing sequences, without having to be told; and it also works out the correct escape sequences from terminfo, without having them hardwired.)
You've completely banjanxed the Bourne Again shell's idea of what's been printed and what it has to erase/rewrite as it displays command history and lets you edit the command line.
Breaking your prompt down into sections:
[e]0;u@h: wa]— non-printing characters, properly enclosed$debian_chroot:+($debian_chroot)— printing characters only, presumably[33[01;36m]— non-printing characters, properly enclosedu@h— printing characters only[33[00m]— non-printing characters, properly enclosed33[01;34m]— non-printing characters, improperly enclosed so the Bourne Again shell does not know that they arew33[00m]— an erroneous mixture of printing and non-printing characters[$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]— printing characters only, presumably
I've given this advice before, but it is general advice that applies here as well:
- Use either
eor33consistently, for your own sanity. - Make your
[and]strictly matching non-nesting pairs. - Make sure that all non-printing sequences are within
[and](and that, conversely, that all printing sequences are not).
(This is why I personally prefer the Z Shell and its alternative prompt expansion mechanism for when I want wacky coloured prompts. It knows that things like %Fgreen aren't printing sequences, without having to be told; and it also works out the correct escape sequences from terminfo, without having them hardwired.)
edited Mar 20 '17 at 10:18
Community♦
1
1
answered Oct 20 '16 at 16:43
JdeBP
33k468155
33k468155
Thanks a lot I modified my PS1 in[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.
– melisc
Oct 21 '16 at 8:52
+1 for the use ofbanjanxed
– Jarrod Roberson
Apr 18 at 15:25
add a comment |
Thanks a lot I modified my PS1 in[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")]and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.
– melisc
Oct 21 '16 at 8:52
+1 for the use ofbanjanxed
– Jarrod Roberson
Apr 18 at 15:25
Thanks a lot I modified my PS1 in
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")] and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.– melisc
Oct 21 '16 at 8:52
Thanks a lot I modified my PS1 in
[e]0;u@h: wa]$debian_chroot:+($debian_chroot) [e[01;36m]u@h[e[00m][e[01;34m]w[e[00m][$(type __git_ps1 >/dev/null 2>&1 && __git_ps1 "(%s)")] and now it is perfectly working! I had never really understood how that thing worked until I read you explanation.– melisc
Oct 21 '16 at 8:52
+1 for the use of
banjanxed– Jarrod Roberson
Apr 18 at 15:25
+1 for the use of
banjanxed– Jarrod Roberson
Apr 18 at 15:25
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f317734%2fterminal-prompt-overwrites-current-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown