From d0ed623631bcf9abd293e88b8a057b304fe3001c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 13 Feb 2025 12:52:09 -0800 Subject: bug: fullscreen interactions with completion. When the Bash completion stuff for git is loaded, it generates a __git() function. That function's body calls the user's expanded alias, such as "basta.fullscreen_alt git". This expansion of the alias is baked into that function's code. Other completion modules might do a similar thing. The most prudent thing we can do is to assume that calls to basta.fullscreen or basta.fullscreen_alt can happen during tab completion, and in those cases just run the command and bail without doing any full screen logic. * basta.sh (basta.fullscreen, basta.fullscreen_alt): If the $COMP_WORDS variable is not empty, run the command and bail. --- basta.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/basta.sh b/basta.sh index 9741991..44c5a71 100644 --- a/basta.sh +++ b/basta.sh @@ -290,6 +290,11 @@ basta.import_array() # Public API functions basta.fullscreen() { + if [ -n "$COMP_WORDS" ]; then + command "$@" + return $? + fi + local realrows=$(( LINES + basta_prev_reserved_rows + 1 )) local exit= local saveint=$(trap -p INT) @@ -322,6 +327,11 @@ basta.fullscreen() { } basta.fullscreen_alt() { + if [ -n "$COMP_WORDS" ]; then + command "$@" + return $? + fi + local realrows=$(( LINES + basta_prev_reserved_rows + 1 )) local curline local i -- cgit v1.2.3