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

Undo sometimes causes the editor to go blank #3003

Closed
REAS opened this Issue Dec 9, 2014 · 18 comments

Comments

Projects
None yet
6 participants
@REAS
Member

REAS commented Dec 9, 2014

I have heard reports from a number of my students that Undo is eating code. This is a note to record the potential issue. I need to research further.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Dec 9, 2014

Member

Is this just #707 (which would often cause strange deletions because people would start typing and have edits happen offscreen) or something new in PDE X?

/cc @Manindra29

Member

benfry commented Dec 9, 2014

Is this just #707 (which would often cause strange deletions because people would start typing and have edits happen offscreen) or something new in PDE X?

/cc @Manindra29

@Manindra29

This comment has been minimized.

Show comment
Hide comment
@Manindra29

Manindra29 Dec 10, 2014

Member

PDE X uses calls to textarea's undo methods only before refactoring(so that all refactoring can be undone with a single undo click). Other than that, it doesn't touch undo as such..

Member

Manindra29 commented Dec 10, 2014

PDE X uses calls to textarea's undo methods only before refactoring(so that all refactoring can be undone with a single undo click). Other than that, it doesn't touch undo as such..

@REAS

This comment has been minimized.

Show comment
Hide comment
@REAS

REAS Feb 6, 2015

Member

OK, I have finally seen this after continued reports from students. The situation here is that with multiple undos (more than a few) all of the code can disappear from the editor window. Then on the next undo, the code reappeared in its different "undone" state. My guess is that students are panicking when they see the code completely gone and they may not continue to undo to bring it back. So, what might be causing this?

Member

REAS commented Feb 6, 2015

OK, I have finally seen this after continued reports from students. The situation here is that with multiple undos (more than a few) all of the code can disappear from the editor window. Then on the next undo, the code reappeared in its different "undone" state. My guess is that students are panicking when they see the code completely gone and they may not continue to undo to bring it back. So, what might be causing this?

@benfry benfry changed the title from Undo has issues in 3.0 alpha releases to Undo sometimes causes the editor to go blank Mar 31, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Mar 31, 2015

Member

The issue is probably tied to the idea of “compound edits”... The editor has to be blanked before new code is added, but those two actions have to be bundled together as a compound edit to avoid this situation.

Where possible, the code should already be doing this, but perhaps we're missing a case.

Member

benfry commented Mar 31, 2015

The issue is probably tied to the idea of “compound edits”... The editor has to be blanked before new code is added, but those two actions have to be bundled together as a compound edit to avoid this situation.

Where possible, the code should already be doing this, but perhaps we're missing a case.

@joelmoniz

This comment has been minimized.

Show comment
Hide comment
@joelmoniz

joelmoniz Aug 21, 2015

Member

I was testing out the undo functionality during the process of easing in the RSTA, and noticed that undo clears everything in the current tab when one does a format. Undoing again adds back the text in its original form. Is it possible that this is one of the cases not bundled as a compound edit, and causing this issue to arise?

Member

joelmoniz commented Aug 21, 2015

I was testing out the undo functionality during the process of easing in the RSTA, and noticed that undo clears everything in the current tab when one does a format. Undoing again adds back the text in its original form. Is it possible that this is one of the cases not bundled as a compound edit, and causing this issue to arise?

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 22, 2015

Member

@joelmoniz's patch for the auto-format case is now merged in for 3.0 beta 5. For people who have seen this, do you think this is the likely cause of the issue?

Member

benfry commented Aug 22, 2015

@joelmoniz's patch for the auto-format case is now merged in for 3.0 beta 5. For people who have seen this, do you think this is the likely cause of the issue?

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 22, 2015

Member

Well, the good news is that this has helped my identify the error and reproduce it consistently. The bad news is that I am still getting it. Here is a screen capture of "auto-format-undo-code-disappearing" sequence.

https://www.dropbox.com/s/qizua1oyv18cpch/auto_format_error.mov?dl=0

Member

shiffman commented Aug 22, 2015

Well, the good news is that this has helped my identify the error and reproduce it consistently. The bad news is that I am still getting it. Here is a screen capture of "auto-format-undo-code-disappearing" sequence.

https://www.dropbox.com/s/qizua1oyv18cpch/auto_format_error.mov?dl=0

@joshgiesbrecht

This comment has been minimized.

Show comment
Hide comment
@joshgiesbrecht

joshgiesbrecht Aug 22, 2015

Contributor

Were you doing something specific before Auto Format in that video? I'm trying the same thing here and unable to reproduce the bug.

Steps I've done:

  1. Type some code.
  2. Select AutoFormat from the Edit menu.
  3. Undo

In fact ... in a case where Auto-Format responds that no changes are necessary, the Undo actually undoes the last thing I typed. ie. the Auto-Format isn't even put on the Undo stack.

Contributor

joshgiesbrecht commented Aug 22, 2015

Were you doing something specific before Auto Format in that video? I'm trying the same thing here and unable to reproduce the bug.

Steps I've done:

  1. Type some code.
  2. Select AutoFormat from the Edit menu.
  3. Undo

In fact ... in a case where Auto-Format responds that no changes are necessary, the Undo actually undoes the last thing I typed. ie. the Auto-Format isn't even put on the Undo stack.

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 22, 2015

Member

@joshgiesbrecht My steps:

  1. Open new sketch.
  2. Type code
  3. Auto-format.
  4. Undo

I'm running 0243 on Mac OS X 10.10.4.

Member

shiffman commented Aug 22, 2015

@joshgiesbrecht My steps:

  1. Open new sketch.
  2. Type code
  3. Auto-format.
  4. Undo

I'm running 0243 on Mac OS X 10.10.4.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 23, 2015

Member

And you're definitely running the latest source? I can't reproduce it.

Member

benfry commented Aug 23, 2015

And you're definitely running the latest source? I can't reproduce it.

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 23, 2015

Member

Yes, just pulled and tested again. Same result. No one else seeing this? Perhaps something is off on my machine. Will test from another one tomorrow.

Member

shiffman commented Aug 23, 2015

Yes, just pulled and tested again. Same result. No one else seeing this? Perhaps something is off on my machine. Will test from another one tomorrow.

@joelmoniz

This comment has been minimized.

Show comment
Hide comment
@joelmoniz

joelmoniz Aug 23, 2015

Member

I've managed to reproduce this on the latest source (in particular, post #3693):

  1. Type in something like void setup() { int x = 20;} in a single line.
  2. Hit Ctrl+T

NB: These steps need to be done as quickly as possible in succession
NB2: The text has to be typed in. Copy-pasting doesn't trigger this.

Member

joelmoniz commented Aug 23, 2015

I've managed to reproduce this on the latest source (in particular, post #3693):

  1. Type in something like void setup() { int x = 20;} in a single line.
  2. Hit Ctrl+T

NB: These steps need to be done as quickly as possible in succession
NB2: The text has to be typed in. Copy-pasting doesn't trigger this.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 23, 2015

Member

@joelmoniz can we actually take the begin/endCompoundEdit() calls out of auto-format now? I think the problem may have been in not calling endTextEditHistory(), since setText() already had begin/endCompoundEdit() around it.

Member

benfry commented Aug 23, 2015

@joelmoniz can we actually take the begin/endCompoundEdit() calls out of auto-format now? I think the problem may have been in not calling endTextEditHistory(), since setText() already had begin/endCompoundEdit() around it.

@joelmoniz

This comment has been minimized.

Show comment
Hide comment
@joelmoniz

joelmoniz Aug 23, 2015

Member

Ah, I'd left the calls in an attempt to have the changing caret position is recorded as well, but I'm not sure if I've handled that part correctly.

Member

joelmoniz commented Aug 23, 2015

Ah, I'd left the calls in an attempt to have the changing caret position is recorded as well, but I'm not sure if I've handled that part correctly.

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 23, 2015

Member

The error is now fixed for me and the actual "auto-formatting" is undone instead of code going blank!

Member

shiffman commented Aug 23, 2015

The error is now fixed for me and the actual "auto-formatting" is undone instead of code going blank!

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 23, 2015

Member

Wow, shall we close this?

Member

benfry commented Aug 23, 2015

Wow, shall we close this?

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 23, 2015

Member

I think maybe yes. . and with this bug, I believe we have finally finished everything there is to be done with Processing, see you on the tropical island!

Member

shiffman commented Aug 23, 2015

I think maybe yes. . and with this bug, I believe we have finally finished everything there is to be done with Processing, see you on the tropical island!

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 23, 2015

Member

May as well call it "4.0" and be done with it.

Member

benfry commented Aug 23, 2015

May as well call it "4.0" and be done with it.

@benfry benfry closed this Aug 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment