Git Bash Windows Terminal Theme Causing Text To Wrap Back And Write Over Prompt

55 Views Asked by At

After searching for the better half of a day I couldn't find anyone else having the same issue.

I am running Windows Terminal with back.exe as the shell.

After installing Agnoster Bash Powerline theme for Bash and using it for some time I noticed that after reaching the end of the current line in the terminal the text will wrap to the beginning of the same line instead of continuing in the next line of the terminal.

Demonstration: Gif of me recreating the issue.

My .bashrc file:

export THEME=$HOME/.bash/themes/agnoster-bash/agnoster.bash
if [[ -f $THEME ]]; then
    export DEFAULT_USER=`whoami`
    source $THEME
fi

alias ls="lsd"

The agnoster.bash file the .bashrc is referencing:

https://github.com/speedenator/agnoster-bash/blob/master/agnoster.bash

I presume this is the relevant part of the theme file:

build_prompt() {
    [[ ! -z ${AG_EMACS_DIR+x} ]] && prompt_emacsdir
    prompt_status
    #[[ -z ${AG_NO_HIST+x} ]] && prompt_histdt
    [[ -z ${AG_NO_CONTEXT+x} ]] && prompt_context
    prompt_virtualenv
    prompt_dir
    prompt_git
    prompt_hg
    prompt_end
}

# from orig...
# export PS1='$(ansi_single $(text_effect reset)) $(build_prompt) '
# this doesn't work... new model: create a prompt via a PR variable and
# use that.

set_bash_prompt() {
    RETVAL=$?
    PR=""
    PRIGHT=""
    CURRENT_BG=NONE
    PR="$(ansi_single $(text_effect reset))"
    build_prompt

    # uncomment below to use right prompt
    #     PS1='\[$(tput sc; printf "%*s" $COLUMNS "$PRIGHT"; tput rc)\]'$PR
    PS1=$PR
}

I have very little experience with customizing my shell prompt soo I wanted to see if anyone more experienced that me has an idea on how to fix my issue.

I will provide any additional details on request.

(edit) Running Git Bash directly without using the Windows Terminal fixes the issue for some reason. The problem could have something to do with how the W.T. writes text?

0

There are 0 best solutions below