Fix edge case in yas-longest-key-from-whitespace

* yasnippet.el (yas-longest-key-from-whitespace): don't try again if
  start-point is on whitespace.
* yasnippet-tests.el (complicated-yas-key-syntaxes): check edge case.
This commit is contained in:
Noam Postavsky 2014-08-10 13:29:25 -04:00
parent 47a3d5f1cb
commit d982b701fc
2 changed files with 3 additions and 2 deletions

View File

@ -351,7 +351,8 @@ TODO: correct this bug!"
(yas--foobarbaz t) (yas--barbaz t))
(yas-should-expand '(("foo-barbaz" . "foo-barOKbazOK")))
(setq yas-key-syntaxes '(yas-longest-key-from-whitespace))
(yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK"))))))))
(yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK")
("foo " . "foo "))))))))
;;; Loading

View File

@ -2749,7 +2749,7 @@ marks it as something else (typically comment ender)."
(if (= (point) start-point)
(yas-try-key-from-whitespace start-point)
(forward-char))
(unless (= original (1+ (point)))
(unless (<= start-point (1+ (point)))
'again))