From 6dbb61031a6200cf774dbf9e85c0edd8df17756c Mon Sep 17 00:00:00 2001 From: TomfromBerlin Date: Mon, 23 Mar 2026 23:21:29 +0100 Subject: [PATCH] Make Ctrl+C work - zsh-autocomplete defines its own TRAPINT() function in a global scope. That is, every other TRAPINT() function defined by the user or other plugins will be overwritten immediately, when autocomplete is active. This leads to unexpected and hard to trace behavior, e.g. if there is a 'read -sk1' and Ctrl+C is pressed, strange error messages appear. The work around is 'read -sk1 || return 1' --- functions/zramdisk_size_func | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/functions/zramdisk_size_func b/functions/zramdisk_size_func index 397b8f9..b6e35e5 100644 --- a/functions/zramdisk_size_func +++ b/functions/zramdisk_size_func @@ -103,7 +103,7 @@ Accepted units: # min size if (( bytes < min_bytes )); then print -P "${ZRAMDISK_COLOR_RED}Too small:${ZRAMDISK_COLOR_NC} Minimum is 16 MiB." - read -srk 1 + read -srk 1 || return 1 continue fi @@ -115,8 +115,6 @@ Accepted units: zramdisk_size="$((bytes / 1024 / 1024))M" typeset -g zramdisk_size_bytes zramdisk_size_bytes=$bytes -# zramdisk_current_choice - #read -sk 1 zramdisk_debug "${ZRAMDISK_COLOR_GREEN}zramdisk_size_func:${ZRAMDISK_COLOR_NC} Success" >&2 return 0 } @@ -225,7 +223,6 @@ zramdisk_debug "${ZRAMDISK_COLOR_CYAN}zramdisk_size_func:${ZRAMDISK_COLOR_NC} Re return 1 ;; esac -# printf '%s\n%s\n' "$number" "$unit" return 0 } #ZRAMDISK_SCRIPT