(sh-font-lock-paren): Fix bug#81192

Since commit 4e1fe56e31 turned several new chars into punctuations,
they're not skipped by (skip-syntax-backward "w_") any more,
so we need to skip them more explicitly instead when trying to
skip a case pattern.

* lisp/progmodes/sh-script.el (sh-font-lock-paren): Skip more
punctuation chars.
* test/lisp/progmodes/sh-script-resources/sh-indents.erts
(sh-indents-case-pattern-bug#81192): New test.
This commit is contained in:
Stefan Monnier 2026-07-26 15:36:19 -04:00
parent b5119ab920
commit b65f8ef93d
2 changed files with 14 additions and 1 deletions

View file

@ -1037,7 +1037,7 @@ subshells can nest."
;; Skip through one pattern
(while
(or (/= 0 (skip-syntax-backward "w_"))
(/= 0 (skip-chars-backward "-$=?[]*@/\\\\"))
(/= 0 (skip-chars-backward "-$=?[]*@/\\\\!%:.^~,"))
(and (sh-is-quoted-p (1- (point)))
(goto-char (- (point) 2)))
(when (memq (char-before) '(?\" ?\' ?\}))

View file

@ -49,3 +49,16 @@ Name: sh-indents5
for i do echo 1; done
for i; do echo 1; done
=-=-=
Name: sh-indents-case-pattern-bug#81192
=-=
case "$1" in
a:b)
echo "a b"
;;
*,*)
echo "other"
;;
esac
=-=-=