Skip to content

Commit

Permalink
Only call reset-prompt when the appropriate zstyle is set
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpneumann authored and masayukig committed Dec 12, 2018
1 parent 49abef3 commit 802a43e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions modules/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ zstyle ':prezto:module:editor' dot-expansion 'yes'

### PS Context

**NOTE:** *This is deprecated and will be removed in future versions.*

To enable the prompt context to be set, add the following to your
*zpreztorc*.

Expand Down
15 changes: 8 additions & 7 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,21 @@ function editor-info {
}
zle -N editor-info

# Reset the prompt based on the current context and
# the ps-context option.
# Reset the prompt based on the current context and whether the prompt utilizes
# the editor:info zstyle. If the prompt does utilize the editor:info, we must
# reset the prompt, otherwise the change in the prompt will never update. If the
# prompt does not utilize the editor:info, we simply redisplay the command line.
function zle-reset-prompt {
if zstyle -t ':prezto:module:editor' ps-context; then
# Explicitly check to see if there is an editor info keymap set that would
# require a reset of the prompt
if zstyle -L ':prezto:module:editor:info*' | grep -v 'completing' > /dev/null 2>&1; then
# If we aren't within one of the specified contexts, then we want to reset
# the prompt with the appropriate editor_info[keymap] if there is one.
if [[ $CONTEXT != (select|cont) ]]; then
zle reset-prompt
zle -R
fi
else
zle reset-prompt
zle -R
fi
zle -R
}
zle -N zle-reset-prompt

Expand Down
2 changes: 1 addition & 1 deletion modules/prompt/functions/prompt_smiley_setup
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function prompt_smiley_precmd {

function prompt_smiley_setup {
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(percent subst)
prompt_opts=(cr percent sp subst)

# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_smiley_precmd
Expand Down
3 changes: 0 additions & 3 deletions runcoms/zpreztorc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'

# Allow the zsh prompt context to be shown.
#zstyle ':prezto:module:editor' ps-context 'yes'

#
# Git
#
Expand Down

0 comments on commit 802a43e

Please sign in to comment.