Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

ctrl+z (undo) doesn't work after save anymore since 1.5 #11826

Closed
vankasteelj opened this issue Oct 15, 2015 · 379 comments · Fixed by #12175
Closed

ctrl+z (undo) doesn't work after save anymore since 1.5 #11826

vankasteelj opened this issue Oct 15, 2015 · 379 comments · Fixed by #12175
Assignees

Comments

@vankasteelj
Copy link

vankasteelj commented Oct 15, 2015

There's no way of reverting a change that was made if the file was saved. I don't know if that's a feature (saved=saved), but it's really annoying, especially when working with git. I had to reinstall 1.4 because of that, I cannot do any work without my "undo"^^

Windows 10 x86_64
Ubuntu 15.10 x64

EDIT: november 1st, 2016 : TL&DR; check out #11826 (comment)

@dacrhu
Copy link

dacrhu commented Oct 15, 2015

I use Fedora linux, in my Brackets working fine.

@K-Thompson
Copy link

I was getting ready to open the same issue but notice this post. I can confirm the same behavior with Windows 7 64 bit.

@abose
Copy link
Contributor

abose commented Oct 16, 2015

Can you try debug>reload without extensions and see if the problem persists?
Which extensions are installed in brackets?

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

I got the exact same issue, with no extensions installed.
Windows 10 64-bit

@abose
Copy link
Contributor

abose commented Oct 16, 2015

Can you go to debug>show developer tools>console and comment the console logs here after undo fails?

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

I think this is what you meant:

Download the React DevTools for a better development experience: http://fb.me/react-devtools

/utils/DeprecationWarning.js:90 PreferencesManager.convertPreferences() has been deprecated. Please upgrade to the current Preferences system (https://github.com/adobe/brackets/wiki/Preferences-System#conversion-from-the-pre-36-preferences-system).
    at Object.convertPreferences (/preferences/PreferencesManager.js:325:28)
    at Object.eval (/utils/Resizer.js:548:24)
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)

/command/Menus.js:820 Error setting menu item shortcut: 1
/command/Menus.js:820 (anonymous function)
/LiveDevelopment/MultiBrowserImpl/transports/NodeSocketTransport.js:87 NodeSocketTransport - start

file:///C:/Program%20Files%20(x86)/Brackets/www/SELECT%20*%20FROM%20custome…=%20:address%20AND%20postalcode%20=%20:postalcode%20AND%20city%20=%20:city Failed to load resource: net::ERR_FILE_NOT_FOUND

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

When I save the document seems to be flashing quickly, just as if I would open it anew.
Maybe there's something that causes the document to be refreshed/reloaded? And therefore flushes the undo history?

@abose
Copy link
Contributor

abose commented Oct 16, 2015

Are you working with live preview when this happens?

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

Nope :)

@abose
Copy link
Contributor

abose commented Oct 16, 2015

/command/Menus.js:820 Error setting menu item shortcut: 1
Can you try debug>reload without extensions just to be sure.

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

Hm, that worked, surprisingly. The document doesn't appear to be reloading now after being saved. And undo works. Huzzah!
What's odd is that I haven't installed any extensions.

@abose
Copy link
Contributor

abose commented Oct 16, 2015

deleting %appdata%/brackets folder should fix it then.

@jrtell1
Copy link

jrtell1 commented Oct 16, 2015

Yup, that did it. Great :D

@vankasteelj
Copy link
Author

I will try that and make sure to report back.

@igormakovsky
Copy link

Can confirm the same issue on macOS Yosemite (10.10.5)

@vankasteelj
Copy link
Author

Ok, deleting %appdata%\Brackets solved the issue. I re-installed all my extensions and it still works. So maybe deleting everything isn't needed, like only 1 precise file?

The only change between 1.4 and 1.5 I had before encountering the error was to install Extract and ExportPDF. Maybe the issue comes from there?

Just in case it helps, here's a list of the extensions installed before I deleted the entire AppData folder:
2015-10-16_13-45-21
2015-10-16_13-45-34
2015-10-16_13-45-41

@vankasteelj
Copy link
Author

Aaaand the issue is back. It's a bug, definitively. It worked for a few hours and now it does not.

@josephlimb
Copy link

Same issue here: Ubuntu 14.04, Brackets 1.5

@abose abose added this to the Release 1.6 milestone Oct 17, 2015
@codingyourlife
Copy link

My undo history got cleared every time I saved (v1.5). debug>reload without plugins helped. Even after saying debug>reload with plugins it kept working again. I didn't uninstall the old version, just installed v1.5.

@Rainbowlemon
Copy link

I'm getting the same issue. Reloading without extensions fixes it (though I've not been using it for long). This only applies to my Windows 10 64bit install - I've not got this problem on OSX.

@abose
Copy link
Contributor

abose commented Oct 20, 2015

Did this happen only after upgrading to 1.5?

@Rainbowlemon
Copy link

Yeah, I just upgraded from 1.4 and encountered it in the first document I edited.

@TonyPeterson
Copy link

Ditto... I'm only experiencing it in my JS files tho, not my HTML or SCSS.

@noreliq
Copy link

noreliq commented Oct 22, 2015

Happening with PHP files

Only happened after updating to 1.5

Release 1.5 build 1.5.0-16538 (release cf9cf46)
Windows 7

@chris-thorn
Copy link

Same here. Only tried with PHP files so far.

Debug > Reload Without Extensions has so far fixed the issue, but it's only been minutes since I've done that.

Upgrade from 1.4 to 1.5.0-16538 (release cf9cf46).

Windows 10 Pro 64-bit

@abose
Copy link
Contributor

abose commented Oct 23, 2015

We are looking into this issue on priority.

@thany
Copy link

thany commented Oct 23, 2015

Same here, with javascript files so far.
Windows 7 x64, version 1.5.0. No problems in 1.4.0.

I'll have to revert to 1.4.0 for the moment. This bug is costing me too much real work.

@vahid-sanati
Copy link

vahid-sanati commented Oct 31, 2016

Found Solution!!!
just modified these 2 variables in the Editor.prototype._resetText function and it totally fixed the problem.

added before any other code inside function:
text = text.replace(/(?:\r\n|\r|\n)/g, "\r\n");

and modified currentText definition to this one:
var currentText = this._codeMirror.getValue().replace(/(?:\r\n|\r|\n)/g, "\r\n");

Bye Bye undo reset!

Edit : The solution works great and after lots of tests I didn't faced the problem anymore even once. But this solution only makes text comparison properly detect the difference and the fact that the new lines of the saved code is different than the new lines of the code in the editor still remains and developers should take care of that!

@tonybrasunas
Copy link

Bravo @vahid-sanati! Now let's see if this fixes the issue for others as well.

@zaggino
Copy link
Contributor

zaggino commented Oct 31, 2016

So what we have here is that line-endings of the original file are different than line-endings that are put into the file, when save has been made. I think we can fix this quickly for 1.8 cc @ficristo @petetnt

@petetnt
Copy link
Collaborator

petetnt commented Oct 31, 2016

That's pretty interesting @vahid-sanati, great job. I always have normalized line-endings, which explains why I (and many others) never run into that particular issue.

Another fix for 1.8. sounds good to me, create a PR and aim it towards release branch.

Again, great job 👍

@vahid-sanati
Copy link

thank you @petetnt @zaggino and all other developers for your great application. I love brackets and I just didn't want to give up on it.
I'm glad I could help you fix this issue.

@vankasteelj
Copy link
Author

vankasteelj commented Nov 1, 2016

Thanks ! I applied the patch from the PR, let's give it a run on the next few days :)

Note: quick reminder, follow this guide, download this patch, and apply it with: git apply 12865.diff Once the PR gets merged, to get back on track, do: git stash && git pull

@vahid-sanati
Copy link

vahid-sanati commented Nov 1, 2016

@vankasteelj tested and works fine.

Edit: separated the external changes dialog issue.

@zaggino
Copy link
Contributor

zaggino commented Nov 1, 2016

@vahid-sanati that external changes dialog should be treated as a separate issue outside of this, please open a new issue and copy-paste there how you're able to replicate it, thanks

@thany
Copy link

thany commented Nov 4, 2016

I'm working on a PHP project right now, and undo doesn't works after save every single time. It's completely reproducible.

Just thought you might like to know.

But again, just remove history nuking alltogether for now - we'll be better off without it if this bug can't be fixed. I'll keep repeating this, jsyk.

@zaggino
Copy link
Contributor

zaggino commented Nov 4, 2016

@thany Please read @vahid-sanati's comments above and try the same thing he did to figure out what is the problem on his machine. Otherwise, your comments are quite useless.

@thany
Copy link

thany commented Nov 4, 2016

Why is removing history nuking alltogether not an option?

How is it better to lose work, than to have a little bit too much of it?

Besides, if the bug is fixed, as the comment implies, put out a maintenance release! No need to wait another couple of months until 1.9 is "ready".

@vankasteelj
Copy link
Author

I haven't encountered the issue in the previous days, and i've been pretty busy coding on brackets :) it's a good sign so far

@vahid-sanati
Copy link

@thany if you haven't applied the fix #12865 of course the problem will still happen to you. the final 1.8 release will have the fix. apply the patch or wait for the final release. If you don't want to work with source you can edit main.js file inside the install directory of brackets to apply the fix (actually I did all my tests with this method, never tried the source) but you should be careful with escaped characters!

@swmitra swmitra removed this from the Release 1.9 milestone Mar 15, 2017
@petetnt
Copy link
Collaborator

petetnt commented May 15, 2017

This should have been fixed for a while now, if this pops up ever again, please do open a new issue so that it can be addressed immediately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet