Merge pull request #1188 from ZyX-I/zsh-ZLE_PROMPT_INDENT

Support ZLE_RPROMPT_INDENT
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-11-22 23:05:19 +03:00
commit ef0e5039a1
2 changed files with 6 additions and 2 deletions

View File

@ -142,10 +142,14 @@ class Prompt(object):
} }
zsh.setvalue('_POWERLINE_PARSER_STATE', None) zsh.setvalue('_POWERLINE_PARSER_STATE', None)
zsh.setvalue('_POWERLINE_SHORTENED_PATH', None) zsh.setvalue('_POWERLINE_SHORTENED_PATH', None)
try:
zle_rprompt_indent = zsh.getvalue('ZLE_RPROMPT_INDENT')
except IndexError:
zle_rprompt_indent = 1
r = '' r = ''
if self.above: if self.above:
for line in self.powerline.render_above_lines( for line in self.powerline.render_above_lines(
width=zsh.columns() - 1, width=zsh.columns() - zle_rprompt_indent,
segment_info=segment_info, segment_info=segment_info,
): ):
r += line + '\n' r += line + '\n'

View File

@ -144,7 +144,7 @@ _powerline_setup_prompt() {
new_args_2+=' --renderer_arg="local_theme=continuation"' new_args_2+=' --renderer_arg="local_theme=continuation"'
local add_args_3=$add_args' --renderer_arg="local_theme=select"' local add_args_3=$add_args' --renderer_arg="local_theme=select"'
local add_args_2=$add_args$new_args_2 local add_args_2=$add_args$new_args_2
add_args+=' --width=$(( ${COLUMNS:-$(_powerline_columns_fallback)} - 1 ))' add_args+=' --width=$(( ${COLUMNS:-$(_powerline_columns_fallback)} - ${ZLE_RPROMPT_INDENT:-1} ))'
local add_args_r2=$add_args$new_args_2 local add_args_r2=$add_args$new_args_2
PS1='$($=POWERLINE_COMMAND shell aboveleft '$add_args')' PS1='$($=POWERLINE_COMMAND shell aboveleft '$add_args')'
RPS1='$($=POWERLINE_COMMAND shell right '$add_args')' RPS1='$($=POWERLINE_COMMAND shell right '$add_args')'