]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-ts-mode: Fix an out-of-bounds error with heredoc at eob
authorDmitry Gutov <dmitry@gutov.dev>
Sun, 24 Dec 2023 01:58:49 +0000 (03:58 +0200)
committerEshel Yaron <me@eshelyaron.com>
Tue, 2 Jan 2024 07:15:47 +0000 (08:15 +0100)
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--syntax-propertize):
Fix an out-of-bounds error with heredoc at eob.

(cherry picked from commit da2e440462b643427de94433f5e8d0e1330c7450)

lisp/progmodes/ruby-ts-mode.el

index d3daa7370d4a9a0f7af40685d0c287dfac336c88..2675481cc4cc461bb1eab420cc9e26f911a75838 100644 (file)
@@ -1063,8 +1063,9 @@ leading double colon is not added."
         ('heredoc
          (put-text-property (treesit-node-start node) (1+ (treesit-node-start node))
                             'syntax-table (string-to-syntax "\""))
-         (put-text-property (treesit-node-end node) (1+ (treesit-node-end node))
-                            'syntax-table (string-to-syntax "\"")))
+         (when (< (treesit-node-end node) (point-max))
+           (put-text-property (treesit-node-end node) (1+ (treesit-node-end node))
+                              'syntax-table (string-to-syntax "\""))))
         ('percent
          ;; FIXME: Put the first one on the first paren in both %Q{} and %().
          ;; That would stop electric-pair-mode from pairing, though.  Hmm.