fix(fold): handle bounding error

This basically stops the "not overlay" error we were getting when you
tried to jump to many times. this does have the disadvantage of not
jumping at all if the amount of jumps is higher than the amount of
overlays but this can be fixed in a future commit if necessary.
This commit is contained in:
Jeetaditya Chatterjee 2021-11-08 15:22:49 +00:00
parent c16e16e92b
commit 6127692848
No known key found for this signature in database
GPG key ID: 09D54CECD2132B91

View file

@ -172,7 +172,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(cl-sort (eval `(overlays-in ,@arg-list))
(lambda (ov1 ov2)
(funcall comp-fun (overlay-start ov1) (overlay-start ov2)))))))
(if ovs (goto-char (overlay-start (nth (- (abs count) 1) ovs))))))))
(if (and ovs (<= count (length ovs)))
(goto-char (overlay-start (nth (- (abs count) 1) ovs))))))))
if (save-excursion (funcall fn))
collect it into points
finally do