Sublime Forum

(Ubuntu) Saving files refreshes and -unfolds- all code block

#1

Hi,

As the title says, every time I save a file I’m coding in, the file refreshes and unfolds everything, causing me to lose my spot, and depending on how many lines I’ve written requires me to search back to my original spot, which is quite the bother. Is there a way to disable this?

Thanks.

0 Likes

#2

Bump. This is actually a usage-breaking problem. Is there anyone from the actual team that looks at these forums?

0 Likes

#3

as a workaround, meanwhile you may use github.com/SublimeText/BufferScroll wich will try to keep your scroll and cursor positions (among other things)

I think your problem may be caused by an external program that touches that file… (?)

0 Likes

#4

Yep. Same problem as OP

just started to use code folding on ST3 but every time i save the code gets unfolded.
Is this how it’s supposed to be ?

Lozminda

0 Likes

#5

Sublime reloading any file at any time is an indication that something outside of Sublime is modifying the file in some fashion; thus under the assumption that you’ve used something external to edit the file, the file gets reloaded so you don’t inadvertently damage your file. A consequence of a file being reloaded is that code folding goes away because Sublime doesn’t persist code folds that exist when you close a file and later reopen it.

The thing causing the file modifications could be anything, from some external tasks that’s touching the files somehow (like if you’re running something that auto-generates parts of files) to a plugin in Sublime that’s trying to beautify code and it’s doing it in an incorrect fashion.

0 Likes

Unfolding on save
#6

Am saving the file in ST3. Nothing else is touching it… I press crtl + s, folding goes away. Is this expected behaviour ?

After all Marks, BookMarks, Tabs etc etc etc all stay the same… (I’ve just tested)

Ta

0 Likes

#7

Could you try reverting to a freshly installed state? It may be that a plugin is causing issues.

0 Likes

#8

Ah ha back to freshly installed state !
I do have a ‘clean’ version (well it’s got multicommand, package dev, cont, and res view) so I will get round to checking all the unanswered stuff out on it, soon - ish.
I’ll make a list of unsolved stuff too, we might be able to check some of them off (or at least have a better idea of the cause…)
Cheers

0 Likes

#9

Thus the answer to my previous post

just started to use code folding on ST3 but every time i save the code gets unfolded.
Is this how it’s supposed to be ?

is yes ? Code folding doesn’t persist after a save. I’ve tried on a clean build and indeed the code folding disappears. Thanks for your help.

0 Likes

#10

This is observably false:

2020-06-06_15-15-55

0 Likes

#11

Sorry my mistake, I’ve confused save and close. When I exit Sublime, or close and reopen a file the folding dissapears, which as you’ve stated is expected behaviour.

It’s if you like “legacy behaviour” on my part, the fact that files “persist” (don’t know if that’s the right word) on ST3 without being saved is fuddling me a bit maybe…

Anyway my bad, apologies all, I meant close, not save.

0 Likes

#12

If you don’t like that behavior you can turn it off using "hot_exit": false, "remember_open_files": true. This will remember the files you have open, but not store unsaved data in your session.

0 Likes

#13

Thank you !

0 Likes