mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Closes #562: Deleting inner numberless snippet causes error
* yasnippet.el (yas--field-probably-deleted-p): Protect against nil `yas--field-number'. * yasnippet-tests.el (delete-numberless-inner-snippet-issue-562): New test
This commit is contained in:
parent
d19ef74634
commit
316435e03e
@ -112,6 +112,17 @@
|
||||
(ert-simulate-command `(yas-mock-insert "abc"))
|
||||
(should (string= (yas--buffer-contents) "abcabcabcabc"))))
|
||||
|
||||
(ert-deftest delete-numberless-inner-snippet-issue-562 ()
|
||||
(with-temp-buffer
|
||||
(yas-minor-mode 1)
|
||||
(yas-expand-snippet "${3:${test}bla}$0${2:ble}")
|
||||
(ert-simulate-command '(yas-next-field-or-maybe-expand))
|
||||
(should (looking-at "testblable"))
|
||||
(ert-simulate-command '(yas-next-field-or-maybe-expand))
|
||||
(ert-simulate-command '(yas-skip-and-clear-or-delete-char))
|
||||
(should (looking-at "ble"))
|
||||
(should (null (yas--snippets-at-point)))))
|
||||
|
||||
;; (ert-deftest in-snippet-undo ()
|
||||
;; (with-temp-buffer
|
||||
;; (yas-minor-mode 1)
|
||||
|
@ -3016,7 +3016,8 @@ through the field's start point"
|
||||
;; the field numbered 0, just before the exit marker, should
|
||||
;; never be skipped
|
||||
;;
|
||||
(not (zerop (yas--field-number field)))))
|
||||
(not (and (yas--field-number field)
|
||||
(zerop (yas--field-number field))))))
|
||||
|
||||
(defun yas--snippets-at-point (&optional all-snippets)
|
||||
"Return a sorted list of snippets at point.
|
||||
|
Loading…
x
Reference in New Issue
Block a user