Skip to content

Commit 2f5c37a

Browse files
committed
Fixed long line search string.
1 parent c7a3d3a commit 2f5c37a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docstr.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,15 @@ execute it inside the buffer. Otherwire, if it's an integer call function
236236
`forward-line' instead.
237237
238238
Argument SR is the target symbol for us to stop looking for the end of declaration."
239-
(let (beg)
239+
(let (beg found)
240240
(save-excursion
241241
(cond ((functionp type) (funcall type))
242242
((integerp type) (forward-line type)))
243243
(unless (docstr-util-current-line-empty-p)
244244
(setq beg (line-beginning-position))
245-
(re-search-forward sr nil t)
245+
(while (and (not (docstr-util-current-line-empty-p)) (not found))
246+
(setq found (re-search-forward sr (line-end-position) t))
247+
(forward-line 1))
246248
(backward-char (length (match-string 0)))
247249
(buffer-substring beg (point))))))
248250

@@ -252,7 +254,8 @@ Argument SR is the target symbol for us to stop looking for the end of declarati
252254
See function `docstr--get-search-string' description for arguments TYPE
253255
and SR."
254256
(let (search-string)
255-
(setq search-string (docstr--get-search-string type sr)
257+
(setq search-string (or (ignore-errors (docstr--get-search-string type sr))
258+
"")
256259
search-string (string-trim search-string)
257260
search-string (s-replace "\n" " " search-string))))
258261

0 commit comments

Comments
 (0)