Skip to content

Commit

Permalink
fix: Edit mode in bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Feb 6, 2025
1 parent 8dcfbfc commit 4fdf3e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vs-edit-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@
(forward-char 1)
(string= (vs-edit--before-char-string) ch))))

(defun vs-edit--first-forward-char-in-line-p (ch)
"Return t if the CH is the first character on the right in line."
(save-excursion
(when (re-search-forward "[^[:space:]]" (line-end-position) t)
(string= (vs-edit--before-char-string) ch))))

;;
;; (@* "Core" )
;;
Expand Down Expand Up @@ -215,7 +221,7 @@
(when (vs-edit--current-line-totally-empty-p) (insert ln-cur))))
;; XXX: Make sure brackets on newline!
(if (or (and behind-brackets
(string= "}" (string-trim (thing-at-point 'line))))
(vs-edit--first-forward-char-in-line-p "}"))
(and (derived-mode-p 'sgml-mode)
(vs-edit--tag-on-line-p)))
(save-excursion (newline-and-indent))
Expand Down

0 comments on commit 4fdf3e5

Please sign in to comment.