Skip to content

Commit a062c77

Browse files
committed
Ensure on newline
1 parent b842ee3 commit a062c77

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

docstr-key.el

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@ conditions."
7575

7676
(defun docstr-key-single-line-prefix-insertion ()
7777
"Insertion for single line comment."
78-
(let* ((prev-line-text (save-excursion (forward-line -1) (thing-at-point 'line)))
79-
(prev-line-doc-symbol (docstr-util-comment-line-symbol -1))
80-
(current-line-doc-symbol (docstr-util-comment-line-symbol))
81-
(next-line-doc-symbol (docstr-util-comment-line-symbol 1))
82-
(prev-line-content (string-trim (s-replace prev-line-doc-symbol "" prev-line-text))))
83-
(when (or (docstr-util-string-match-mut-p prev-line-doc-symbol next-line-doc-symbol)
84-
(and (not (string-empty-p prev-line-content))
85-
(not (docstr-util-contain-list-type-str
86-
docstr-key-inhibit-doc-symbol prev-line-doc-symbol 'strict))
87-
(string= current-line-doc-symbol next-line-doc-symbol)))
88-
(insert (concat (docstr-util-min-str prev-line-doc-symbol next-line-doc-symbol) " "))
89-
(indent-for-tab-command))))
78+
(when (docstr-util-current-line-empty-p)
79+
(let* ((prev-line-text (save-excursion (forward-line -1) (thing-at-point 'line)))
80+
(prev-line-doc-symbol (docstr-util-comment-line-symbol -1))
81+
(current-line-doc-symbol (docstr-util-comment-line-symbol))
82+
(next-line-doc-symbol (docstr-util-comment-line-symbol 1))
83+
(prev-line-content (string-trim (s-replace prev-line-doc-symbol "" prev-line-text))))
84+
(when (or (docstr-util-string-match-mut-p prev-line-doc-symbol next-line-doc-symbol)
85+
(and (not (string-empty-p prev-line-content))
86+
(not (docstr-util-contain-list-type-str
87+
docstr-key-inhibit-doc-symbol prev-line-doc-symbol 'strict))
88+
(string= current-line-doc-symbol next-line-doc-symbol)))
89+
(insert (concat (docstr-util-min-str prev-line-doc-symbol next-line-doc-symbol) " "))
90+
(indent-for-tab-command)))))
9091

9192
(defun docstr-key-javadoc-asterik (fnc &rest args)
9293
"Asterik key for Javadoc like document string.

0 commit comments

Comments
 (0)