Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Sections do not remain folded

A topic by jamesgeek created Jul 05, 2021 Views: 352 Replies: 8
Viewing posts 1 to 9
(+1)

Hello Billiam,

thanks a lot for your cool update. The folding of the sections is really ingenious and reminds me a lot of the org-mode of Emacs. Maybe it's me, but shouldn't the sections stay folded even with the shortcuts until you unfold them yourself? At the moment they unfold automatically as soon as I start writing in another section. Only if I manually put the three dots after the heading it works. I can't imagine that this is intentional? In addition, the first heading is generally not folded in, if you use the shortcut to fold in all sections.

If this distinction between the "..." and the shortcuts is so intentional, I didn't say anything *haha*.

Have a nice day :)

Thanks!

Yeah, there’s an issue with folded sections unfolding when they’ve been folded via shortcuts. Thanks for the bug report, I’ll try to get it fixed ASAP. :)

Fixed a host of regressions related to key shortcuts for folding in 0.25.1.

Thanks again!

Wow, you are really fast!

I had a quick look and the folding by shortcut now works almost perfectly. The only thing I noticed is that folding all sections with the shortcut Ctrl-K Ctrl-1 does not work reliably in all situations yet. For example, if you have only one depth of headings in a document (# Heading 1, # Heading 2, # Heading 3), the first section is generally not folded. However, if you have multiple depths in the headings (# Heading 1 ##, Heading 1.1, ### Heading 1.1.1) it works perfectly! The next one is maybe a habit from org-mode, but don't you think that the shortcut to fold the current selection, should unfold the selection too? ;)

By the way: it is not self-evident how fast you fix the bugs and add new features here. It's very motivating for me personally to see your working zeal. You are doing a damn great job :)

Just found something else. If you apply Ctrl-K Ctrl-1 in the following text and then use Ctrl Shift [ or the "..." to fold the first heading and unfold it again, the second section unfolds right along with it.

# Heading

Text

## Bug?

Bug?

### Heading...

Text

There are a few issues still, obviously 😅

One has to do with the first heading in a file, when the file has no frontmatter, and no content before the heading. I think I have a fix/workaround for this.

The other one, sub-headings getting unfolded, is a little misleading, I think. It may depend on how you unfold it, and the content of the folded area.

Headings unfold automatically when the cursor moves into the folded content. If you fold a heading, and then press the left arrow key to move into the folded area (from the right side), you’re actually moving into last character of the folded content (which in that case is inside ### Heading... which is inside ## Bug?, so they all get unfolded at once).

If you double click the # heading prefix, or use a shortcut key to unfold the first heading only, or click the fold placeholder, I think you won’t see the recursive unfold you’re seeing now.

There’s some misleading behavior for unfolding as well, that I want to fix. If your cursor is after the fold marker, the unfold key won’t affect that line, but will if you use the command from before the fold marker.

I’m not super happy with that behavior overall, and want to change it in the future.

There’s another bug (that this exposed) where you may see two headings on a single line when using fold all. I think I have a fix for that one as well.

don’t you think that the shortcut to fold the current selection, should unfold the selection too

There’s a separate shortcut for that! … but not in the default bindings.

With emacs bindings, it’s C-x C-e, with vim it will be za. I need to add one for the default bindings as well, but haven’t decided on the key to use for it, that won’t interfere with default bindings, or come as a big surprise. By default, I don’t believe sublime (which the default bindings are based on) supports a fold-toggling key.

Thanks again!

(+1)

I see. It's really more complicated than it seems at first. *haha*

But it's already really good to use in its current form and the few exceptions where it's still misleading don't even stand out.

I worked with it all day today and the folding and unfolding is really a great enrichment.

Have a nice evening :)

Released v0.25.2 with a large number of tweaks and bugfixes for folding. There are likely still issues, but it should be a significant improvement.

Woah, update time! :)

Everything works like a charm now. I seriously can't find any bugs anymore.

Many thanks to the Markdown whisperer *haha*.