Merge pull request #1069 from ZyX-I/workaround-1068

Do not use _POWERLINE_SHORTENED_PATH or unset it shortly after using
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-09-09 00:22:33 +04:00
commit 257732bd82
5 changed files with 15 additions and 10 deletions

View File

@ -129,6 +129,7 @@ class Prompt(object):
def __str__(self):
zsh.eval('_POWERLINE_PARSER_STATE="${(%):-%_}"')
zsh.eval('_POWERLINE_SHORTENED_PATH="${(%):-%~}"')
segment_info = {
'args': self.args,
'environ': environ,
@ -137,6 +138,8 @@ class Prompt(object):
'parser_state': zsh.getvalue('_POWERLINE_PARSER_STATE'),
'shortened_path': zsh.getvalue('_POWERLINE_SHORTENED_PATH'),
}
zsh.setvalue('_POWERLINE_PARSER_STATE', None)
zsh.setvalue('_POWERLINE_SHORTENED_PATH', None)
r = ''
if self.above:
for line in self.powerline.render_above_lines(

View File

@ -103,10 +103,6 @@ _powerline_set_jobnum() {
_POWERLINE_JOBNUM=${(%):-%j}
}
_powerline_set_shortened_path() {
_POWERLINE_SHORTENED_PATH="${(%):-%~}"
}
_powerline_update_counter() {
zpython '_powerline.precmd()'
}
@ -120,8 +116,6 @@ _powerline_setup_prompt() {
fi
done
precmd_functions+=( _powerline_set_jobnum )
chpwd_functions+=( _powerline_set_shortened_path )
_powerline_set_shortened_path
VIRTUAL_ENV_DISABLE_PROMPT=1
@ -144,7 +138,7 @@ _powerline_setup_prompt() {
add_args+=' --last_exit_code=$?'
add_args+=' --last_pipe_status="$pipestatus"'
add_args+=' --renderer_arg="client_id=$$"'
add_args+=' --renderer_arg="shortened_path=$_POWERLINE_SHORTENED_PATH"'
add_args+=' --renderer_arg="shortened_path=${(%):-%~}"'
add_args+=' --jobnum=$_POWERLINE_JOBNUM'
local new_args_2=' --renderer_arg="parser_state=${(%%):-%_}"'
new_args_2+=' --renderer_arg="local_theme=continuation"'

View File

@ -1,5 +1,7 @@
unset HOME
unsetopt promptsp notransientrprompt
setopt interactivecomments
setopt autonamedirs
# POWERLINE_CONFIG_PATH=$PWD/powerline/config_files
# POWERLINE_THEME_CONFIG=( default_leftonly.segment_data.hostname.args.only_if_ssh=false )
# POWERLINE_CONFIG=( ext.shell.theme=default_leftonly )
@ -11,7 +13,7 @@ export VIRTUAL_ENV=
cd tests/shell/3rd
cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV="/home/USER/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bgscript.sh & waitpid.sh
false
@ -38,6 +40,8 @@ do
break
done
1
cd .
cd .
hash -d foo=$PWD:h ; cd .
POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
true

View File

@ -1,7 +1,7 @@
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd .git
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="/home/USER/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
@ -33,6 +33,8 @@ abc
1) def 2) ghi 3) jkl
                   Select variant  1
def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
 INSERT $ABC~foo  3rd $ABCtrue

View File

@ -1,7 +1,7 @@
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd .git
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="/home/USER/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
@ -33,6 +33,8 @@ abc
1) def 2) ghi 3) jkl
 Select variant  1
def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
 INSERT $ABC~foo  3rd $ABCtrue