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

[Windows] CTRL+Z clears a node's contents #37

Closed
desplesda opened this issue Sep 18, 2019 · 1 comment · Fixed by #238
Closed

[Windows] CTRL+Z clears a node's contents #37

desplesda opened this issue Sep 18, 2019 · 1 comment · Fixed by #238
Labels
bug Something isn't working

Comments

@desplesda
Copy link
Collaborator

Issue by renaudbedard
Monday Aug 22, 2016 at 15:07 GMT
Originally opened as InfiniteAmmoInc/Yarn#37


Test case :

  • Create a node, add content
  • Exit node
  • Double-click on that same node
  • Hit CTRL-Z
  • Node text disappears, and that operation can't be undone

Before hitting CTRL+Z

image

After hitting CTRL+Z

image

@desplesda desplesda added the bug Something isn't working label Sep 18, 2019
@desplesda
Copy link
Collaborator Author

Comment by rcuddy
Wednesday Jun 28, 2017 at 10:28 GMT


This 'clear' action on ctrl + z still happens, but at least on 0.2.1 ctrl + y puts the text back.

From what I can tell in the debugger the bit that's causing this to happen is ace.js undoChanges function. It calculates a delta of changes and if I understand it correctly, the act of loading a node into the ace editor causes a delta state of "it was empty, then I had a bunch of text". The wierd set of tabs and spaces you get are the result of the tabs inside the index.html <div class="editor" id="editor" .... >{tab and spaces}</div> which ace considers the initial state to fall back to. If you remove those spaces, or populate the empty space with your own text, you can see that when the undo delta triggers you get whatver was between the open and closing tags.

That's great, that's the problem identified.

I have no idea how ace works though, so I'm not sure how to fix this. Does anyone have any suggestions on how we could interrupt the ace undo method if we're at the first local change which was "load node text into editor" ? I though the ctrl+z stuff in app.js updateHighlights may have been what was supposed to be doing this, but it seems that block of code is never actually called, at least that I've seen as yet.

FaultyFunctions added a commit to FaultyFunctions/Crochet that referenced this issue Jan 22, 2021
- Now you can type a bunch of stuff in one node, then type a bunch of stuff in another node, and then go back to the first node and press Ctrl+Z. It won't delete the entire content of the node anymore, it'll undo just like if you have just typed the text.
FaultyFunctions added a commit to FaultyFunctions/Crochet that referenced this issue Jan 22, 2021
- Now you can type a bunch of stuff in one node, then type a bunch of stuff in another node, and then go back to the first node and press Ctrl+Z. It won't delete the entire content of the node anymore, it'll undo just like if you have just typed the text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant