diff --git a/prompt_fresh_setup b/prompt_fresh_setup index ee0a6cb..47d8db0 100644 --- a/prompt_fresh_setup +++ b/prompt_fresh_setup @@ -129,9 +129,27 @@ fresh_line_one() { } fresh_almostontop() { - clear - fresh_line_one - print -P "$PROMPT"'$1' + # CSI ESC[6n gets the cursor position in the form ESC[;R + printf "\033[6n" + # Discard prefix delimited by [ + read -s -d [ + # Store the delimited by ; in row + read -s -d \; row + # Discard suffix delimted by R otherwise it is output to the tty + read -s -d R + # Move the cursor to the bottom of the terminal + # CSI ESC[B moves the cursor down lines + let "down = $LINES - $row" + printf "\033[${down}B" + # Print new lines to push the old command out of view + let "new = $row - 3" + for (( i = 0; i < $new; i++ )); do + printf "\n" + done + # Move the cursor to the line below the prompt + # CSI ESC[A moves the cursor up lines + let "up = $LINES - 3" + printf "\033[${up}A" } fresh_compile_git_prompt() {