Only try expansion when the self-insertion character is a shell meta-char

This commit is contained in:
tsi 2026-01-03 01:29:07 +01:00
parent 9f4875ebcc
commit 0593b06daf
No known key found for this signature in database

View file

@ -212,6 +212,13 @@ _try_abbrev_internal () {
declare -r point line_until_point=${line::point}
if
# Check if the self-insertion character is a shell metacharacter, except tab and newline (we don't want
# interactive alias expansion on tab and newline is represented as the empty self-insertion character)
case "$self_insertion" in
(["${_bash_meta_chars_without_tab_and_nl[*]}"]|'') ;;
(*) false
esac &&
# Check if the character at point is a shell metacharacter or EOL
# [[ $point -eq ${#line} || "${line:point:1}" = ["${_bash_meta_chars[*]}"] ]] &&
# NOTE: Above line commented out, it's actually not that useful.