aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-02-13 12:52:09 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-02-13 12:52:09 -0800
commitd0ed623631bcf9abd293e88b8a057b304fe3001c (patch)
tree1101ca0309d3c52977f29f3e3a4799a059372866
parentcfce7162f4f72eaa77d717c96a4cf299db8f042b (diff)
downloadbasta-d0ed623631bcf9abd293e88b8a057b304fe3001c.tar.gz
basta-d0ed623631bcf9abd293e88b8a057b304fe3001c.tar.bz2
basta-d0ed623631bcf9abd293e88b8a057b304fe3001c.zip
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.
-rw-r--r--basta.sh10
1 files changed, 10 insertions, 0 deletions
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