fix(init): support Midnight Commander

resolves #3415
This commit is contained in:
Jan De Dobbeleer 2023-01-29 13:49:55 +01:00 committed by Jan De Dobbeleer
parent 2839cd3468
commit a0931f84a4
2 changed files with 15 additions and 5 deletions

View file

@ -10,6 +10,11 @@ PS0='${omp_start_time:0:$((omp_start_time="$(_omp_start_timer)",0))}'
PS2="$(::OMP:: print secondary --config="$POSH_THEME" --shell=bash --shell-version="$BASH_VERSION")"
function _set_posh_cursor_position() {
# not supported in Midnight Commander
# see https://github.com/JanDeDobbeleer/oh-my-posh/issues/3415
if [[ -v MC_SID ]];then
return
fi
echo -ne "\033[6n" # ask the terminal for the position
read -s -d\[ garbage # discard the first part of the response
read -s -d R pos # store the position in bash variable 'pos'

View file

@ -8,6 +8,11 @@ export POSH_PROMPT_COUNT=0
PS2="$(::OMP:: print secondary --config="$POSH_THEME" --shell=zsh)"
function _set_posh_cursor_position() {
# not supported in Midnight Commander
# see https://github.com/JanDeDobbeleer/oh-my-posh/issues/3415
if [[ -v MC_SID ]];then
return
fi
echo -ne "\033[6n" # ask the terminal for the position
read -s -d\[ garbage # discard the first part of the response
read -s -d R pos # store the position in bash variable 'pos'