aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsmihica <smihica@gmail.com>2013-09-16 09:06:13 +0900
committersmihica <smihica@gmail.com>2013-09-16 09:06:13 +0900
commite95c6d3af2c95ac7805a39151cdc69eec194d6a5 (patch)
tree35ec18d7de3bb5bd73b2a47f212eeb2529c85767 /src
parente7caf8aa87cb687ea7b86f564892461e1b60cfd6 (diff)
downloademmet-mode-e95c6d3af2c95ac7805a39151cdc69eec194d6a5.tar.lz
emmet-mode-e95c6d3af2c95ac7805a39151cdc69eec194d6a5.tar.xz
emmet-mode-e95c6d3af2c95ac7805a39151cdc69eec194d6a5.zip
Fixed a bug that cursor position is not working when whitespace is on the top of the snippet.
Diffstat (limited to 'src')
-rw-r--r--src/mode-def.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mode-def.el b/src/mode-def.el
index c5cce80..7f5d064 100644
--- a/src/mode-def.el
+++ b/src/mode-def.el
@@ -68,7 +68,7 @@ For more information see `emmet-mode'."
(when pretty
(delete-region (second expr) (third expr))
(emmet-insert-and-flash pretty)
- (when (and emmet-move-cursor-after-expanding (= (elt pretty 0) ?<))
+ (when (and emmet-move-cursor-after-expanding (emmet-html-text-p markup))
(let ((p (point)))
(goto-char
(+ (- p (length pretty))
@@ -132,8 +132,6 @@ See also `emmet-expand-line'."
(buffer-substring (second expr) (point))
(second expr) (point))))))
-
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Real-time preview
;;
@@ -165,6 +163,9 @@ See also `emmet-expand-line'."
(define-key map [(control ?g)] 'emmet-preview-abort)
map))
+(defun emmet-html-text-p (markup)
+ (string-match "^[\s|\t|\n|\r]*<.*$" markup))
+
(defun emmet-preview-accept ()
(interactive)
(let ((ovli emmet-preview-input))
@@ -176,7 +177,7 @@ See also `emmet-expand-line'."
(when markup
(delete-region (line-beginning-position) (overlay-end ovli))
(emmet-insert-and-flash markup)
- (when (and emmet-move-cursor-after-expanding (= (elt markup 0) ?<))
+ (when (and emmet-move-cursor-after-expanding (emmet-html-text-p markup))
(let ((p (point)))
(goto-char
(+ (- p (length markup))