SublimeText-Markdown / MarkdownEditing

Powerful Markdown package for Sublime Text with better syntax understanding and good color schemes.
MIT License
3.17k stars 649 forks source link

Changing `mde.auto_fold_link.enabled` from `true` to `false` while document open leaves UI broken #742

Closed 0xdevalias closed 7 months ago

0xdevalias commented 7 months ago

Overview

There seems to be a bug when changing mde.auto_fold_link.enabled from true to false while a document is open.

To Reproduce

With a document open (tested on an unsaved file, unsure if it applies to both saved/unsaved) that will have it's links collapsed:

- [Foo](#foo)
- [Bar](#bar)
- [Baz](#baz)

With mde.auto_fold_link.enabled set to true, the links are collapsed as expected:

image

And reveal again when we click on the link section:

image

Leaving that file open, if we now set mde.auto_fold_link.enabled to false, the 'collapsed links' are still present:

image

And we can't even click on them to make them visible anymore:

image

Proposed Solution

I'm not sure of the exact mechanics of implementing a fix for this, but my expectation as a user would be that when I disable a setting like that, that any open documents would first have that setting 'unapplied' on them as part of disabling it. (It seems that changing it from false to true does update open documents; so it's even weirder to me as a user that it doesn't work in reverse)

deathaxe commented 7 months ago

A fix requires tracking settings for changes and call unfold once setting value changes to false.