prevent jumpy re-renders on user input

This commit is contained in:
Jorge Morante 2017-10-06 18:18:32 +02:00
parent 0de3d1e814
commit 612c2252a4
2 changed files with 11 additions and 6 deletions

View File

@ -85,11 +85,11 @@ fingers_defaults=( \
[fingers-hint-position]="left" \
[fingers-hint-format]="#[fg=yellow,bold]%s" \
[fingers-highlight-format]="#[fg=yellow,bold,dim]%s" \
[fingers-highlight-format]="#[fg=yellow,nobold,dim]%s" \
[fingers-hint-position-nocompact]="right" \
[fingers-hint-format-nocompact]="#[fg=yellow,bold][%s]" \
[fingers-highlight-format-nocompact]="#[fg=yellow,bold,dim]%s" \
[fingers-highlight-format-nocompact]="#[fg=yellow,nobold,dim]%s" \
)
set_tmux_env 'fingers-patterns'

View File

@ -90,7 +90,7 @@ function toggle_compact_state() {
fi
}
function toggle_help() {
function toggle_help_state() {
if [[ $help_state == "0" ]]; then
help_state=1
else
@ -132,19 +132,22 @@ while read -rsn1 char; do
continue
fi
prev_help_state="$help_state"
prev_compact_state="$compact_state"
if [[ $char == "$BACKSPACE" ]]; then
input=""
continue
elif [[ $char == "<ESC>" ]]; then
if [[ $help_state == "1" ]]; then
toggle_help
toggle_help_state
else
exit
fi
elif [[ $char == "" ]]; then
toggle_compact_state
elif [[ $char == "?" ]]; then
toggle_help
toggle_help_state
else
input="$input$char"
fi
@ -152,7 +155,9 @@ while read -rsn1 char; do
if [[ $help_state == "1" ]]; then
show_help "$fingers_pane_id"
else
show_hints "$fingers_pane_id" $compact_state
if [[ "$prev_compact_state" != "$compact_state" ]]; then
show_hints "$fingers_pane_id" "$compact_state"
fi
fi
result=$(lookup_match "$input")