Description
Not quite sure this is a bug or a feature, but (haskell-hide-toggle)
from haskell-collapse
calculates end of overlay region to the next same-level indented code, while ignoring all blank lines. I'd suggest blank lines have to be ignored only in nested indentation levels, not the initial one. The way how code is now folded, with losing all intended spacing between logically unrelated code, makes it overall less readable.
For example:
main = putStrLn $ greet ++ name -- cursor on this line
where
greet = "Hello "
name = "Alice"
topLevelFn = undefined
folds to
main = putStrLn $ greet ++ name...
topLevelFn = undefined
instead of to this
main = putStrLn $ greet ++ name...
topLevelFn = undefined
ie. with initial indentation level blank lines preserved.
Related code in (haskell-find-line-with-indentation)
haskell-mode/haskell-collapse.el
Lines 82 to 84 in bbdbc0e
where blank lines are skipped despite next indentation level found (or end of file).
Maybe some backtracking for last range of empty lines, by comparison of indentation levels between their preceding and the initial one ?