playlist view: add r key (not functioning)

This commit is contained in:
2025-09-01 09:34:32 +02:00
parent fc02d93158
commit 230b534501
2 changed files with 28 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
# Set prompt of input field
# @argument $1: view
# @argument $2: mode
__set_prompt() {
view=$(state_get_view)
mode=$(state_get_mode)
view=$1
mode=$2
case "$view" in
"$VIEW_ARTIST")
name="$(mb_artist "$args" | $JQ -r '.name')"
@@ -79,7 +82,7 @@ fzf_handle_load() {
[ "${DISABLE_SEARCH:-}" ] && printf "+disable-search+change-query(%s)" "${QUERY:-"$FZF_QUERY"}" || printf "+enable-search+change-query(%s)" "${QUERY:-}"
[ "${SHOW_PREVIEW:-}" ] && printf "+show-preview" || printf "+hide-preview"
[ "${ENABLE_CHANGE:-}" ] && printf "+rebind(change)" || printf "+unbind(change)"
__set_prompt
__set_prompt "$view" "$mode"
}
# Print info string for FZF
@@ -243,18 +246,25 @@ fzf_handle_key() {
case "$view" in
"$VIEW_PLAYLIST") ;;
*)
if [ "$mode" = "$MODE_INSERT" ]; then
state_update_keep_args "$view" "$MODE_NORMAL"
__set_prompt
else
printf "put(%s)" "$FZF_KEY"
fi
state_update_keep_args "$view" "$MODE_NORMAL"
__set_prompt "$view" "$mode"
;;
esac
;;
esac
fi
# Keys exclusive to playlist view
if [ "$view" = "$VIEW_PLAYLIST" ]; then
case ",$KEYS_PLAYLIST_RELOAD," in
*",$FZF_KEY,"*)
foo "hit playlist reload key"
foo "going to call $(printf "reload:%s" "$0 --fzf-reload")"
printf "reload:%s" "$0 --fzf-reload"
;;
esac
fi
# Handle key press
case ",$KEYS_HALFPAGE_DOWN," in
*",$FZF_KEY,"*) printf "half-page-down" ;;
@@ -536,7 +546,7 @@ fzf_handle_key() {
"$VIEW_PLAYLIST") ;;
*)
state_update_keep_args "$view" "$MODE_INSERT"
__set_prompt
__set_prompt "$view" "$mode"
;;
esac
;;
@@ -568,6 +578,7 @@ fzf_handle_key() {
# Post processing
[ "${QUERY:-}" ] && printf "+change-query(%s)" "$QUERY"
if [ "${VIEW_NEXT:-}" ]; then
[ "$VIEW_NEXT" = "$VIEW_PLAYLIST" ] && MODE_NEXT="$MODE_NORMAL"
state_update "$VIEW_NEXT" "${MODE_NEXT:-"$mode"}" "${VIEW_NEXT_ARGS:-}"
[ "${ACCEPT:-}" ] && printf "+accept" || printf "+reload:%s" "$0 --fzf-reload"
fi