diff options
| author | nyamatongwe <devnull@localhost> | 2000-04-03 12:02:22 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2000-04-03 12:02:22 +0000 | 
| commit | fdd724a0710ea14c6bb0ca42a7e2f86a8633f36d (patch) | |
| tree | 07bf07fe658f12e2ae734b61af1ca53ec8598a8f /src | |
| parent | dda4ea2c804522c57e6dc2e4ae1ab1bb8b0ac073 (diff) | |
| download | scintilla-mirror-fdd724a0710ea14c6bb0ca42a7e2f86a8633f36d.tar.gz | |
Fixed problems with undo history not coalescing undo nodes correctly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CellBuffer.cxx | 12 | ||||
| -rw-r--r-- | src/CellBuffer.h | 3 | 
2 files changed, 11 insertions, 4 deletions
| diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 1b1320667..4d032f94f 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -315,12 +315,13 @@ Action::~Action() {  	Destroy();  } -void Action::Create(actionType at_, int position_, char *data_, int lenData_) { +void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) {  	delete []data;  	position = position_;  	at = at_;  	data = data_;  	lenData = lenData_; +	mayCoalesce = mayCoalesce_;  }  void Action::Destroy() { @@ -335,12 +336,14 @@ void Action::Grab(Action *source) {  	at = source->at;  	data = source->data;  	lenData = source->lenData; - +	mayCoalesce = source->mayCoalesce; +	  	// Ownership of source data transferred to this  	source->position = 0;  	source->at = startAction;  	source->data = 0;  	source->lenData = 0; +	source->mayCoalesce = true;  }  // The undo history stores a sequence of user operations that represent the user's view of the  @@ -425,7 +428,9 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng  				//Platform::DebugPrintf("action coalesced\n");  			}  		} else { -			currentAction++; +			// Actions not at top level are always coalesced unless this is after return to top level +			if (!actions[currentAction].mayCoalesce) +				currentAction++;  		}   	} else {  		currentAction++; @@ -457,6 +462,7 @@ void UndoHistory::EndUndoAction() {  			actions[currentAction].Create(startAction);  			maxAction = currentAction;  		} +		actions[currentAction].mayCoalesce = false;  	}  } diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 6e052077e..1d7f57b05 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -79,10 +79,11 @@ public:  	int position;  	char *data;  	int lenData; +	bool mayCoalesce;  	Action();  	~Action(); -	void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0); +	void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true);  	void Destroy();  	void Grab(Action *source);  }; | 
