working on #3003 and #3702 (issues with compound edits and undo)

This commit is contained in:
Ben Fry
2015-08-23 07:37:06 -04:00
parent 4763b52da1
commit 83df446cd9
2 changed files with 20 additions and 17 deletions

View File

@@ -1911,10 +1911,20 @@ public abstract class Editor extends JFrame implements RunnerListener {
/**
* Use before a manipulating text to group editing operations together as a
* single undo. Use stopCompoundEdit() once finished.
* Use before a manipulating text to group editing operations together
* as a single undo. Use stopCompoundEdit() once finished.
*/
public void startCompoundEdit() {
// Call endTextEditHistory() before starting a new CompoundEdit,
// because there's a timer that's possibly set off for 3 seconds after
// which endTextEditHistory() is called, which means that things get
// messed up. Hence, manually call this method so that auto-format gets
// undone in one fell swoop if the user calls auto-formats within 3
// seconds of typing in the last character. Then start a new compound
// edit so that the auto-format can be undone in one go.
// https://github.com/processing/processing/issues/3003
endTextEditHistory();
stopCompoundEdit();
compoundEdit = new CompoundEdit();
caretUndoStack.push(textarea.getCaretPosition());
@@ -2216,17 +2226,6 @@ public abstract class Editor extends JFrame implements RunnerListener {
if (formattedText.equals(source)) {
statusNotice(Language.text("editor.status.autoformat.no_changes"));
} else {
/*
* Call endTextEditHistory() before starting a new CompoundEdit,
* because there's a timer that's possibly set off for 3 seconds after
* which endTextEditHistory() is called, which means that things get
* messed up. Hence, manually call this method so that auto-format gets
* undone in one fell swoop if the user calls auto-formats within 3
* seconds of typing in the last character. Then start a new compound
* edit so that the auto-format can be undone in one go.
* (Refer to issue #3003)
*/
endTextEditHistory();
startCompoundEdit();
// replace with new bootiful text

View File

@@ -10,11 +10,18 @@ X prompt to install Xcode coming up on Export to Application
X http://stackoverflow.com/questions/15371925/how-to-check-if-command-line-tools-is-installed
X "xcode-select -p" returns 0 if they exist (and the dir) or 2 if they don't
X no special case added for 10.8, but it's on the way out
X move processing.mode.java.pdex.XQErrorTable to processing.ui.ErrorTable
X need to make the list abstract, also "scroll to line" feature
X fix red in sidebar, the squiggly line beneath code
contribs
X Undo does not move to the correct location in the editor window
X https://github.com/processing/processing/issues/707
X https://github.com/processing/processing/pull/3660
_ Undo sometimes causes the editor to go blank
_ https://github.com/processing/processing/issues/3003
X https://github.com/processing/processing/pull/3693
X https://github.com/processing/processing/pull/3702
gsoc
X Foundation libraries disapear from CM after restart
@@ -127,7 +134,7 @@ _ replace about screen (1x and 2x versions)
_ change 'alpha' to correct name
_ also change the revision in the "about processing" dialog
_ https://github.com/processing/processing/issues/3665
_ fix red in sidebar, the squiggly line beneath code
_ different design of squiggly line?
_ Error/warning location visualisation not updating when editor resizes
_ https://github.com/processing/processing/issues/3619
_ error/warning location is awkward when no scroll bar is in use
@@ -155,9 +162,6 @@ _ update EditorButton rollover label when pressing shift or alt
_ disable the debug toggle menu while running
_ otherwise could run in one mode, then try to stop in another
_ recent menu gets huge with other p5 versions on osx
_ move processing.mode.java.pdex.XQErrorTable to processing.ui.ErrorTable
_ need to make the list abstract, also "scroll to line" feature
_ fix up the UI, oy
_ show compiling/startup animation after clicking run
_ or maybe show an animation for starting up
_ rather than post-compile