Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown heading folding - clicking anywhere in document un-folds everything #664

Open
troy opened this issue Nov 14, 2021 · 5 comments
Open
Labels

Comments

@troy
Copy link

troy commented Nov 14, 2021

Anyone actually using heading folding with Markdown? If I fold a heading (with Shift+Tab or right-click, MarkdownEditing, "Fold current section"), that folding state only lasts until I click anywhere else in the document (even in content in an unrelated heading). As soon as I click anywhere else, it's unfolded.

There doesn't appear to be any package settings to change this behavior, and it occurs with global folding as well. If I do "Fold all headings," as soon as I click anywhere in the document, all headings are unfolded again.

This behavior seems close to useless other than as a last-resort way to navigate within a document.

Is anyone actually using heading folding with Markdown? If so, what do you use it for? Am I missing a way to preserve each heading's folding status separately, so the document can be partially-unfolded while it's actually used? That seems like the entire use case for Markdown heading folding - to show the portion of a document you're working on and collapse the rest - but that doesn't appear to be possible.

I'd love to hear that I missed something in the docs (and if I did, I'll make a PR to clarify the behavior for future users). Thanks.

@deathaxe
Copy link
Member

I can't reproduce this behavior and it is not designed to work like that.

You could call sublime.log_commands() in ST's console to find out which command is triggered when clicking somewhere in the document.

@simosdev
Copy link

simosdev commented Nov 20, 2021

This seems to be a bug which happens when you first install the package and haven't yet restarted Sublime Text.
Experienced the same issue as troy when first time installing the package today.

Can be reproduced by

  1. Remove MarkdownEditing package
  2. Restart Sublime Text
  3. Install MarkdownEditing package
  4. Try folding a markdown section and move selection away

When you haven't restarted Sublime the auto link folding doesn't seem to work either.
Sublime Text version: Stable Channel Build 4221

sublime.log_commands() outputs below with folding a heading with Shift + Tab and then moving up, own or clicking away with mouse.
Results were the same in buggy and working editor.

command: mde_fold_section
command: move {"by": "lines", "forward": false}

command: mde_fold_section
command: move {"by": "lines", "forward": true}

command: mde_fold_section
command: drag_select {"event": {"button": 1, "x": 351.5, "y": 292.5}}

@deathaxe deathaxe added bug and removed unconfirmed labels Nov 20, 2021
@deathaxe
Copy link
Member

Thank's for the info. I can reproduce it. The issue seems to be caused by link auto folding.

@troy
Copy link
Author

troy commented Nov 20, 2021

Hey all, sorry for the late response! I launched an initiative campaign last week and things got busy 🙂 I just confirmed that this goes away after the first restart (which I hadn't done), so my experience is the same as simosdev's. deathaxe, thanks a ton for being so responsive and for all your hard work on this and other repos.

@glow12121
Copy link

I, too, confirm that the bug appears after initial installation of the plugin and goes away after ST is restarted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants