fix(fold): fold-levels off-by-one
Without this change, we need to pass a prefix arg that is one more than the actual fold-level we're trying to achieve; `C-u 2` is equivalent to not passing a digit arg. While this looks intentional, I don't see what purpose it serves. This change provides saner behavior that matches other commands that handle fold-levels (eg. `org-fold-hide-sublevels`).
This commit is contained in:
parent
a24ff58a5a
commit
bff7baca69
1 changed files with 4 additions and 4 deletions
|
@ -189,9 +189,9 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
(+fold--ensure-hideshow-mode)
|
(+fold--ensure-hideshow-mode)
|
||||||
(if (integerp level)
|
(if (integerp level)
|
||||||
(progn
|
(progn
|
||||||
(outline-hide-sublevels (max 1 (1- level)))
|
(outline-hide-sublevels (max 1 level))
|
||||||
(hs-life-goes-on
|
(hs-life-goes-on
|
||||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))))
|
(hs-hide-level-recursive level (point-min) (point-max))))
|
||||||
(hs-show-all)
|
(hs-show-all)
|
||||||
(when (fboundp 'outline-show-all)
|
(when (fboundp 'outline-show-all)
|
||||||
(outline-show-all)))))))
|
(outline-show-all)))))))
|
||||||
|
@ -211,8 +211,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
(hs-life-goes-on
|
(hs-life-goes-on
|
||||||
(if (integerp level)
|
(if (integerp level)
|
||||||
(progn
|
(progn
|
||||||
(outline--show-headings-up-to-level (1+ level))
|
(outline--show-headings-up-to-level level)
|
||||||
(hs-hide-level-recursive (1- level) (point-min) (point-max)))
|
(hs-hide-level-recursive level (point-min) (point-max)))
|
||||||
(hs-hide-all)
|
(hs-hide-all)
|
||||||
(when (fboundp 'outline-hide-sublevels)
|
(when (fboundp 'outline-hide-sublevels)
|
||||||
(outline-show-only-headings))))))))
|
(outline-show-only-headings))))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue