Improve initial outline folding condition

This commit is contained in:
TEC 2020-10-05 10:52:50 +08:00
parent 6fb063b9f6
commit 42ad4e6153
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 7 additions and 2 deletions

View File

@ -302,8 +302,13 @@ the beginning of the buffer."
(setq buffer-read-only nil)
(lexic-parse-failed)
(setq buffer-read-only t)
(when (< 30 (count-lines (point-min) (point-max)))
(outline-hide-sublevels 3))
(let* ((window (get-buffer-window (lexic-get-buffer)))
(win-height (window-height window))
(content-height (count-lines (point-min) (point-max))))
(when (> 0.5 (/ (float win-height) content-height))
(outline-hide-sublevels 3)))
(goto-char (point-min))
(search-forward "\u200B\u200B")
(left-char 1)))