From 318c67ffbee929422b294351e5886282d5d4757a Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 15 Jan 2026 11:41:16 +0800 Subject: [PATCH] perf: optimize search filter rendering in paginated menu - Use partial redraw for search input updates instead of full screen refresh - Reduces flickering when typing in the filter box - Improve responsiveness of search interaction --- lib/ui/menu_paginated.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/ui/menu_paginated.sh b/lib/ui/menu_paginated.sh index cce6c96..2dc5cd0 100755 --- a/lib/ui/menu_paginated.sh +++ b/lib/ui/menu_paginated.sh @@ -864,7 +864,14 @@ paginated_multi_select() { # Backspace filter if [[ "$filter_mode" == "true" && -n "$filter_query" ]]; then filter_query="${filter_query%?}" - need_full_redraw=true + # Fast footer-only update in filter mode (avoid full redraw) + local filter_status="${filter_query:-_}" + local footer_row=$((items_per_page + 4)) + printf "\033[%d;1H\033[2K" "$footer_row" >&2 + local sep=" ${GRAY}|${NC} " + printf "%s" "${GRAY}Search: ${filter_status}${NC}${sep}${GRAY}Delete${NC}${sep}${GRAY}Enter Confirm${NC}${sep}${GRAY}ESC Cancel${NC}" >&2 + printf "\033[%d;1H\033[2K" "$((footer_row + 1))" >&2 + continue fi ;; CHAR:*) @@ -873,7 +880,14 @@ paginated_multi_select() { # avoid accidental leading spaces if [[ -n "$filter_query" || "$ch" != " " ]]; then filter_query+="$ch" - need_full_redraw=true + # Fast footer-only update in filter mode (avoid full redraw) + local filter_status="${filter_query:-_}" + local footer_row=$((items_per_page + 4)) + printf "\033[%d;1H\033[2K" "$footer_row" >&2 + local sep=" ${GRAY}|${NC} " + printf "%s" "${GRAY}Search: ${filter_status}${NC}${sep}${GRAY}Delete${NC}${sep}${GRAY}Enter Confirm${NC}${sep}${GRAY}ESC Cancel${NC}" >&2 + printf "\033[%d;1H\033[2K" "$((footer_row + 1))" >&2 + continue fi fi ;;