[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 9500b00 21/40: Fix field navigation in the backwards direc
From: |
Noam Postavsky |
Subject: |
[elpa] master 9500b00 21/40: Fix field navigation in the backwards direction |
Date: |
Wed, 26 Oct 2016 23:06:33 +0000 (UTC) |
branch: master
commit 9500b000fde22cdb59ad178ae7c4920e866ba329
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Fix field navigation in the backwards direction
* yasnippet.el (yas--find-next-field): For negative N, actually give the
Nth previous field, not the 1st field.
* yasnippet-tests.el (field-navigation): Add a 3rd field, and test
calling `yas-prev-field' while on it.
Fixes #722.
---
yasnippet-tests.el | 7 +++++--
yasnippet.el | 3 +--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index b0906d5..c5fd376 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -38,14 +38,17 @@
(ert-deftest field-navigation ()
(with-temp-buffer
(yas-minor-mode 1)
- (yas-expand-snippet "${1:brother} from another ${2:mother}")
+ (yas-expand-snippet "${1:brother} from ${2:another} ${3:mother}")
(should (string= (yas--buffer-contents)
"brother from another mother"))
-
(should (looking-at "brother"))
(ert-simulate-command '(yas-next-field-or-maybe-expand))
+ (should (looking-at "another"))
+ (ert-simulate-command '(yas-next-field-or-maybe-expand))
(should (looking-at "mother"))
(ert-simulate-command '(yas-prev-field))
+ (should (looking-at "another"))
+ (ert-simulate-command '(yas-prev-field))
(should (looking-at "brother"))))
(ert-deftest simple-mirror ()
diff --git a/yasnippet.el b/yasnippet.el
index 79861ee..cae33a0 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3079,8 +3079,7 @@ Otherwise delegate to `yas-next-field'."
(and (not (eq field active))
(yas--field-probably-deleted-p snippet field)))
(yas--snippet-fields snippet))))
- (if (>= n 0) (nth n (memq active live-fields))
- (car (last (memq active (reverse live-fields)) (- n))))))
+ (nth (abs n) (memq active (if (>= n 0) live-fields (reverse
live-fields))))))
(defun yas-next-field (&optional arg)
"Navigate to the ARGth next field.
- [elpa] master 1532e66 33/40: Fix saving of new snippets, (continued)
- [elpa] master 1532e66 33/40: Fix saving of new snippets, Noam Postavsky, 2016/10/26
- [elpa] master 0ee86a2 23/40: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 00be21c 36/40: Change cl dep to cl-lib for tests too, Noam Postavsky, 2016/10/26
- [elpa] master 9c9952c 12/40: Add test for indentation of single line mirrors, Noam Postavsky, 2016/10/26
- [elpa] master 4296a86 15/40: yasnippet.el (yas--quote-string): Remove., Noam Postavsky, 2016/10/26
- [elpa] master d4da806 17/40: Fix removal of snippets by uuid, Noam Postavsky, 2016/10/26
- [elpa] master 42b0c26 18/40: Don't warn about modifications to other buffers, Noam Postavsky, 2016/10/26
- [elpa] master eaaec30 38/40: Replace all occurances of `capitaomorte', Noam Postavsky, 2016/10/26
- [elpa] master ff6f31e 37/40: Replace yas--with-temp-redefs with cl-letf, Noam Postavsky, 2016/10/26
- [elpa] master 244cdfa 26/40: Merge: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 9500b00 21/40: Fix field navigation in the backwards direction,
Noam Postavsky <=
- [elpa] master 309fe15 31/40: * Rakefile: Handle unset `warnings' parameter, Noam Postavsky, 2016/10/26
- [elpa] master 9cf9208 32/40: Fix test-rebindings, Noam Postavsky, 2016/10/26
- [elpa] master 7e0a0de 28/40: Use new name of python-in-string/comment in docs, Noam Postavsky, 2016/10/26
- [elpa] master e6b8651 39/40: * NEWS: Update for 0.11.0., Noam Postavsky, 2016/10/26
- [elpa] master 5264379 29/40: Cleanup redundant cl dependency, :group & :require, Noam Postavsky, 2016/10/26
- [elpa] master 4b12f7d 30/40: Don't warn about cl-functions with old cl-lib, Noam Postavsky, 2016/10/26
- [elpa] master a5e88b2 34/40: Add test for snippet saving, Noam Postavsky, 2016/10/26
- [elpa] master 299efcb 40/40: packages/yasnippet: Merge external (v0.11.0), Noam Postavsky, 2016/10/26