branch: elpa/smartparens commit 77327ee064009f1bb1702a88f3383af3ecf72524 Author: Matus Goljer <matus.gol...@gmail.com> Commit: Matus Goljer <matus.gol...@gmail.com>
fix(ruby): fix out-of-bounds error when determining line position Since the pre-hook runs after the opening delimiter was removed, the original position of the end delimiter is actually moved back (length op) points back. So the check could in some cases at the end of the buffer result into trying to read positions over the point-max which crashes. --- smartparens-ruby.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartparens-ruby.el b/smartparens-ruby.el index bc906d1d84..31267c7ddb 100644 --- a/smartparens-ruby.el +++ b/smartparens-ruby.el @@ -142,8 +142,8 @@ ID, ACTION, CONTEXT." (sp-get enc (let ((beg-line (line-number-at-pos :beg-in)) (end-line (line-number-at-pos :end-in))) - (when (equal action 'slurp-backward) + (setq end-line (- end-line :op-l)) (save-excursion (sp-forward-sexp) (when (looking-at-p ";") (forward-char))