I'm using Ubuntu-18.04.2's original ~/.bashrc file and I have done no changes in any original files.

Do Ubuntu 18.04.2 users experience the problem I'm going to describe to you down below? Let me know, please.

I've noticed weird behaviors by varying either the current path's length or the gnome-terminal's width. I'll give you an example (I use the character | to indicate the window's right border):

username@hostname:/directory/directory/directory/dire  |
ory/directory/directory/directory$                     |

As you can see, at the first row, Ubuntu terminal hides the string "ct" of the word "directory"; the other rows are fine. I said the string "ct" is hidden because, if I resize the window width, that reappears but other two characters are hidden. For example:

username@hostname:/directory/directory/directory/di  |
ctory/directory/directory/directory$                 |

This time the string "re" is hidden. The problem always occurs at the first row!

I've done some experiments and noticed different "weird" behaviors by varying either the current path's length or the window width. I can identify five cases:

  1. If the current path's length is short, I might resize the window width but every row would be still fine (no hidden characters at any rows);
  2. if I increase the length of a little bit (for example adding a directory), the first row's last character is hidden;
  3. If I use cd .. command to return untill the point 1 length and resize the window enough to make the path takes more than one row, five characters are hidden (same length but different behavior);
  4. By varying the window width, part of the row is overwritten as in the following examples: ........ m$ rname@hostname:/directory/directory/directory/directory |

    $ ername@hostname:/directory/directory/directory/directory |

In the first example, the substring "use" is deleted and the character 'm' appears out of nowhere! The second example occurs if I shorten the window width a little bit: as you can see the substring "us" is deleted. In both cases, gnome-terminal lets me write commands over that line which would be deleted as I type.

  1. If I'm inside a directory with a short name such as /usr or /home, the problem doesn't occur because I can't shorten the window enough. However, If I create a long 1st-level directory (e.g. /directorydirectorydirectorydirectorydirectory), I get the following behaviors by resizing the window width:

    username@hostname:/directorydirectorydirectorydirectorydirector | m$
    username@hostname:/directorydirectorydirectorydirectorydirecto | $
    username@hostname:/directorydirectorydirectorydirectorydirect | $ y
    username@hostname:/directorydirectorydirectorydirectorydirec | {square box with 0010 inside}[[00m$
    username@hostname:/directorydirectorydirectorydirectorydire | $ ory
    username@hostname:/directorydirectorydirectorydirectorydir | y$ ory
    username@hostname:/directorydirectorydirectorydirectorydi | ry$ or
    username@hostname:/directorydirectorydirectorydirectoryd | ory$ o
    username@hostname:/directorydirectorydirectorydirectory | tory$

$ grep PS1 ~/.bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

$ printf '%q\n' "$PS1"
\\\[\\e\]0\;\\u@\\h:\ \\w\\a\\\]\$\{debian_chroot:+\(\$debian_chroot\)\}\\\[\\033\[01\;32m\\\]\\u@\\h\\\[\\033\[00m\\\]:\\\[\\033\[01\;34m\\\]\\w\\\[\\033\[00m\\\]\\\$\ 

$ printf '%q\n' "$PROMPT_COMMAND"

$ locale
  • Comments are not for extended discussion; this conversation has been moved to chat. – terdon Apr 15 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.