mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Fixed the bug of not indenting well in narrowed region (Issue 46).
This commit is contained in:
parent
709463d19e
commit
1c0d664d65
22
yasnippet.el
22
yasnippet.el
@ -782,19 +782,21 @@ will be deleted before inserting template."
|
||||
,key
|
||||
,snippet)))
|
||||
|
||||
;; Step 13: Do necessary indenting
|
||||
(save-excursion
|
||||
(let ((ovst (overlay-start (yas/snippet-overlay snippet))))
|
||||
(when ovst
|
||||
(goto-char ovst)
|
||||
(while (re-search-forward "$>" nil t)
|
||||
(replace-match "")
|
||||
(indent-according-to-mode)))))
|
||||
|
||||
;; Step 14: remove the trigger key
|
||||
;; Step 13: remove the trigger key
|
||||
(widen)
|
||||
(delete-char length)
|
||||
|
||||
;; Step 14: Do necessary indenting
|
||||
(save-excursion
|
||||
(let ((ovst (overlay-start (yas/snippet-overlay snippet)))
|
||||
(oven (copy-marker
|
||||
(1+ (overlay-end (yas/snippet-overlay snippet))))))
|
||||
(when (and ovst oven)
|
||||
(goto-char ovst)
|
||||
(while (re-search-forward "$>" oven t)
|
||||
(replace-match "")
|
||||
(indent-according-to-mode)))))
|
||||
|
||||
;; Step 15: Restore undo information, and also save it for future use.
|
||||
(setf (yas/snippet-saved-buffer-undo-list snippet) original-undo-list)
|
||||
(setq buffer-undo-list original-undo-list)
|
||||
|
Loading…
x
Reference in New Issue
Block a user