[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e371c11 1/4: Don't keep region active when expanding from
From: |
Noam Postavsky |
Subject: |
[elpa] master e371c11 1/4: Don't keep region active when expanding from keymap |
Date: |
Mon, 28 Aug 2017 22:21:47 -0400 (EDT) |
branch: master
commit e371c119ecc9044c8ca2d6b93215121eb714d6b1
Author: Noam Postavsky <address@hidden>
Commit: GitHub <address@hidden>
Don't keep region active when expanding from keymap
* yasnippet.el (yas-expand-snippet): Only keep region active if we are
going to field $0 and it has some text.
---
yasnippet.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 94ccffb..aa9fe5e 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3839,9 +3839,14 @@ considered when expanding the snippet."
(when first-field
(sit-for 0) ;; fix issue 125
(yas--letenv (yas--snippet-expand-env snippet)
- (yas--move-to-field snippet first-field))))
+ (yas--move-to-field snippet first-field))
+ (when (and (eq (yas--field-number first-field) 0)
+ (> (length (yas--field-text-for-display
+ first-field))
+ 0))
+ ;; Keep region for ${0:exit text}.
+ (setq deactivate-mark nil))))
(yas--message 4 "snippet %d expanded." (yas--snippet-id snippet))
- (setq deactivate-mark nil)
t))))
(defun yas--take-care-of-redo (_beg _end snippet)