mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-12 08:10:07 +00:00
don't add \n after a full line
This commit is contained in:
parent
8a2207a84e
commit
80b865e736
1 changed files with 13 additions and 8 deletions
|
@ -399,6 +399,7 @@ typeset -gi _P9K_X _P9K_Y _P9K_M
|
||||||
typeset -gi _P9K_RPROMPT_DONE
|
typeset -gi _P9K_RPROMPT_DONE
|
||||||
typeset -g _P9K_ALIGNED_RPROMPT
|
typeset -g _P9K_ALIGNED_RPROMPT
|
||||||
|
|
||||||
|
# Returns 1 if the cursor is at the very end of the screen.
|
||||||
function _p9k_left_prompt_end_line() {
|
function _p9k_left_prompt_end_line() {
|
||||||
_p9k_get_icon LEFT_SEGMENT_SEPARATOR
|
_p9k_get_icon LEFT_SEGMENT_SEPARATOR
|
||||||
_p9k_escape_rcurly $_P9K_RETVAL
|
_p9k_escape_rcurly $_P9K_RETVAL
|
||||||
|
@ -410,10 +411,10 @@ function _p9k_left_prompt_end_line() {
|
||||||
_P9K_PROMPT+="\${_P9K_T[\$_P9K_N]}"
|
_P9K_PROMPT+="\${_P9K_T[\$_P9K_N]}"
|
||||||
_P9K_PROMPT+="%f$1%f%k%b"
|
_P9K_PROMPT+="%f$1%f%k%b"
|
||||||
|
|
||||||
if (( ! _P9K_RPROMPT_DONE )); then
|
(( ! _P9K_RPROMPT_DONE )) || return
|
||||||
_P9K_PROMPT+=$_P9K_ALIGNED_RPROMPT
|
_P9K_PROMPT+=$_P9K_ALIGNED_RPROMPT
|
||||||
_P9K_RPROMPT_DONE=1
|
_P9K_RPROMPT_DONE=1
|
||||||
fi
|
(( ${ZLE_RPROMPT_INDENT:-1} > 0 ))
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
@ -422,8 +423,7 @@ set_default POWERLEVEL9K_PROMPT_ON_NEWLINE false
|
||||||
set_default POWERLEVEL9K_RPROMPT_ON_NEWLINE false
|
set_default POWERLEVEL9K_RPROMPT_ON_NEWLINE false
|
||||||
prompt_newline() {
|
prompt_newline() {
|
||||||
[[ "$1" == "right" ]] && return
|
[[ "$1" == "right" ]] && return
|
||||||
_p9k_left_prompt_end_line
|
_p9k_left_prompt_end_line && _P9K_PROMPT+=$'\n'
|
||||||
_P9K_PROMPT+=$'\n'
|
|
||||||
_P9K_PROMPT+='${${_P9K_BG::=NONE}+}'
|
_P9K_PROMPT+='${${_P9K_BG::=NONE}+}'
|
||||||
if [[ $POWERLEVEL9K_PROMPT_ON_NEWLINE == true ]]; then
|
if [[ $POWERLEVEL9K_PROMPT_ON_NEWLINE == true ]]; then
|
||||||
_p9k_get_icon MULTILINE_NEWLINE_PROMPT_PREFIX
|
_p9k_get_icon MULTILINE_NEWLINE_PROMPT_PREFIX
|
||||||
|
@ -2103,6 +2103,8 @@ prompt_java_version() {
|
||||||
################################################################
|
################################################################
|
||||||
# Main prompt
|
# Main prompt
|
||||||
set_default -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS context dir vcs
|
set_default -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS context dir vcs
|
||||||
|
|
||||||
|
# Returns 1 if the cursor is at the very end of the screen.
|
||||||
build_left_prompt() {
|
build_left_prompt() {
|
||||||
local -i index=1
|
local -i index=1
|
||||||
local element
|
local element
|
||||||
|
@ -2180,8 +2182,11 @@ function _p9k_set_prompt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_P9K_PROMPT=''
|
_P9K_PROMPT=''
|
||||||
build_left_prompt
|
if build_left_prompt; then
|
||||||
PROMPT+=$_P9K_LEFT_PREFIX$_P9K_PROMPT$_P9K_LEFT_SUFFIX
|
PROMPT+=$_P9K_LEFT_PREFIX$_P9K_PROMPT$_P9K_LEFT_SUFFIX
|
||||||
|
else
|
||||||
|
PROMPT+=$_P9K_LEFT_PREFIX$_P9K_PROMPT${_P9K_LEFT_SUFFIX#$'\n'}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -g _P9K_REFRESH_REASON
|
typeset -g _P9K_REFRESH_REASON
|
||||||
|
|
Loading…
Reference in a new issue