Terminal text wrapper working incorrectly during window resize

Hi all!

As the title says above, resizing the terminal window on XFCE to a smaller size than the shell prompt causes the terminal to repeat wrapping text. I have not tested this on other versions of manjaro.

It might be easier to show an example:
My Kernal and Manjaro versions are

ManjaroLinux, Release 20.1, Codename Mikah
Kernal: Linux 5.7.19-2-MANJARO

No problems occur during resize when the shell path is just “~”. However, on any path bigger than this, the terminal repeats the prompt on every increment smaller than the prompt length (e.g. “38x17”, “37x17”, “36x17”, etc), making it look like a mess.

Here is my terminal window at 38x12 in path “LongerNameTest”:
*(Looks normal)

Going to even one size smaller repeats the text (37x12):
*(First line missing “$” and repeating same prompt)

When done a bunch of times, it causes text spew all over the terminal:
*(Terminal prompt Text Spew)

I know it can be cleared pretty easily, but when working from the command line, it would help readability if we did not have to worry about resizing the terminal to maintain workspace cleanliness. Anyone else having this same issue?

Note:
I have screenshots of all these situations, but due to being TL1, I can’t post them :man_shrugging:

Hello, i just tested it. Do you mean something like this?

Peek 2020-09-09 00-00

I guess the color function is causing this problem. Myself i use my own color script and don’t have this issue (also using bash).

Peek 2020-09-09 00-02

Here a sample how i use the colors:

red="\033[0;31m"
yellow="\033[1;33m"
cyan="\033[0;36m"
green="\033[0;32m"
ochre="\033[38;5;95m"
blue="\033[1;34m"
white="\033[0;37m"
reset="\033[0m"
fancyx='\342\234\227'
checkmark='\342\234\223'

set_prompt () {
    Last_Command=$? # Must come first!

    PS1="\[$white\]\$? "

    if [[ $Last_Command == 0 ]]; then
        PS1+="\[$green\]\[$checkmark\] "
    else
        PS1+="\[$red\]\[$fancyx\] "
    fi

    timer_stop
    PS1+="\[($timer_show)\] \t "

    if [[ $EUID == 0 ]]; then
        PS1+="\[$red]\u\[$green\]@\h "
    else
        PS1+="\[$yellow\]\u@\h "
    fi

    PS1+="\[$reset\]\w\n"
    PS1+="\[$(git_color)\]"
    PS1+="\[$(git_branch)\]"
    PS1+="\[$blue\]\$ \[$reset\]"
}

PROMPT_COMMAND='set_prompt'
1 Like

Yes! That is exactly what I was experiencing earlier. Glad to know its not just me and my setup experiencing this.

Since Manjaro uses BASH inherently, are you referring to color() in ‘.bashrc’?
I found this
wiki.archlinux.org/index.php/Bash/Prompt_customization#Prompts
on archwiki, but it doesn’t specify which file controls the manjaro terminal color scheme…

hm… now thinking how the current color function could be fixed…

Update

The Problem is not the color function, but the brackets.

This works without problems:

PS1="\u@\h \W\$ "
manjaro@manjaro Desktop$

but not this:

PS1="[\u@\h \W]\$ "
[manjaro@manjaro Desktop]$

If it is escaped with “\”, then they are not visible. Just removing “[” and “]” which are without “\” before should solve this.