Skip to content

Fix for 2323 issue #2326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions themes/powerline-multiline/powerline-multiline.base.bash
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ function __powerline_right_first_segment_padding() {
}

function __powerline_last_status_prompt() {
if [[ "${1?}" -ne 0 ]]; then
if [[ "${1}" -ne 0 ]]; then
printf '%b %s %b' "$(set_color "${LAST_STATUS_THEME_PROMPT_COLOR-"52"}" -)" "${1}" "${normal?}"
fi
}

function __powerline_prompt_command() {
local last_status="$?" ## always the first
local beginning_of_line='\[\e[G\]'
local beginning_of_line='\[\e[B\]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name should be changed. \e[B moves the cursor one line below, while \e[G moves the cursor to the beginning of line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard name of the control function \e[B defined in ECMA 48 is CURSOR DOWN (and its acronym is CUU), so cursor_down might be one possibility.

However, I think this \e[B doesn't work when the cursor is at the bottom of the terminal display. CUU (i.e. \e[B) moves the cursor only when there is another line below. When the cursor is on the last line of the terminal display CUU (i.e. \e[B) doesn't do anything. @dracorp Could you check the behavior at the bottom of the terminal display?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me:
image
Tested on iTerm2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your intention? The code you suggested seemed to have intended to put the above "Foo" and "master -> origin ..." on separate lines. However, in the above picture, they are placed on the same lines. If this is the expected behavior, actually, you should simply remove beginning_of_line (instead of replacing it with CUD (\e[B)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akinomyoga Probably you are right.
Without beginning_of_line it works in the same way.
I observed this the first time I ran rpm -q --queryformat.

local move_cursor_rightmost='\e[500C'
local info prompt_color segment prompt

Expand All @@ -75,7 +75,7 @@ function __powerline_prompt_command() {

## left prompt ##
# shellcheck disable=SC2068 # intended behavior
for segment in ${POWERLINE_PROMPT[@]-"user_info" "scm" "python_venv" "ruby" "node" "cwd"}; do
for segment in ${POWERLINE_LEFT_PROMPT[@]:-${POWERLINE_PROMPT[@]:-"user_info" "scm" "python_venv" "ruby node" "cwd"}}; do
info="$("__powerline_${segment}_prompt")"
if [[ -n "${info}" ]]; then
__powerline_left_segment "${info}"
Expand Down
Loading