Terminal prompt overwrites current line

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












6














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










share|improve this question




























    6














    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










    share|improve this question


























      6












      6








      6


      1





      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










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:36









      Community

      1




      1










      asked Oct 20 '16 at 15:59









      melisc

      335




      335




















          1 Answer
          1






          active

          oldest

          votes


















          9














          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:




          1. [e]0;u@h: wa] — non-printing characters, properly enclosed


          2. $debian_chroot:+($debian_chroot) — printing characters only, presumably


          3. [33[01;36m] — non-printing characters, properly enclosed


          4. u@h — printing characters only


          5. [33[00m] — non-printing characters, properly enclosed


          6. 33[01;34m] — non-printing characters, improperly enclosed so the Bourne Again shell does not know that they are


          7. w33[00m] — an erroneous mixture of printing and non-printing characters


          8. [$(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 e or 33 consistently, 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.)






          share|improve this answer






















          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          9














          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:




          1. [e]0;u@h: wa] — non-printing characters, properly enclosed


          2. $debian_chroot:+($debian_chroot) — printing characters only, presumably


          3. [33[01;36m] — non-printing characters, properly enclosed


          4. u@h — printing characters only


          5. [33[00m] — non-printing characters, properly enclosed


          6. 33[01;34m] — non-printing characters, improperly enclosed so the Bourne Again shell does not know that they are


          7. w33[00m] — an erroneous mixture of printing and non-printing characters


          8. [$(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 e or 33 consistently, 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.)






          share|improve this answer






















          • 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















          9














          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:




          1. [e]0;u@h: wa] — non-printing characters, properly enclosed


          2. $debian_chroot:+($debian_chroot) — printing characters only, presumably


          3. [33[01;36m] — non-printing characters, properly enclosed


          4. u@h — printing characters only


          5. [33[00m] — non-printing characters, properly enclosed


          6. 33[01;34m] — non-printing characters, improperly enclosed so the Bourne Again shell does not know that they are


          7. w33[00m] — an erroneous mixture of printing and non-printing characters


          8. [$(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 e or 33 consistently, 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.)






          share|improve this answer






















          • 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













          9












          9








          9






          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:




          1. [e]0;u@h: wa] — non-printing characters, properly enclosed


          2. $debian_chroot:+($debian_chroot) — printing characters only, presumably


          3. [33[01;36m] — non-printing characters, properly enclosed


          4. u@h — printing characters only


          5. [33[00m] — non-printing characters, properly enclosed


          6. 33[01;34m] — non-printing characters, improperly enclosed so the Bourne Again shell does not know that they are


          7. w33[00m] — an erroneous mixture of printing and non-printing characters


          8. [$(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 e or 33 consistently, 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.)






          share|improve this answer














          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:




          1. [e]0;u@h: wa] — non-printing characters, properly enclosed


          2. $debian_chroot:+($debian_chroot) — printing characters only, presumably


          3. [33[01;36m] — non-printing characters, properly enclosed


          4. u@h — printing characters only


          5. [33[00m] — non-printing characters, properly enclosed


          6. 33[01;34m] — non-printing characters, improperly enclosed so the Bourne Again shell does not know that they are


          7. w33[00m] — an erroneous mixture of printing and non-printing characters


          8. [$(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 e or 33 consistently, 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.)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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 of banjanxed
            – 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










          • +1 for the use of banjanxed
            – 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

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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






          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)