diff options
| author | nyamatongwe <devnull@localhost> | 2001-01-29 10:00:30 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2001-01-29 10:00:30 +0000 | 
| commit | 73247a096231c75de34218adb69aa97d4af0c9f4 (patch) | |
| tree | 60742ae45ba764d54bc8b988401e6efb9458894f | |
| parent | 95a6589ffba12a6b7c34db1ff18f6c772530bb8a (diff) | |
| download | scintilla-mirror-73247a096231c75de34218adb69aa97d4af0c9f4.tar.gz | |
Fixed problem where BeginUndoAction and EndUndoAction were in wrong order.
Made both the effects of backspace and delete keys be coalesced together
into undo actions.
| -rw-r--r-- | src/CellBuffer.cxx | 13 | ||||
| -rw-r--r-- | src/Editor.cxx | 4 | 
2 files changed, 11 insertions, 6 deletions
| diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 85ecf7d44..690e84c94 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -450,10 +450,6 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng  				currentAction++;  			} else if (currentAction == savePoint) {  				currentAction++; -			} else if ((at == removeAction) && -			           ((position + lengthData * 2) != actPrevious.position)) { -				// Removals must be at same position to coalesce -				currentAction++;  			} else if ((at == insertAction) &&  			           (position != (actPrevious.position + actPrevious.lenData*2))) {  				// Insertions must be immediately after to coalesce @@ -461,6 +457,15 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng              } else if (!actions[currentAction].mayCoalesce) {  				// Not allowed to coalesce if this set  				currentAction++; +            } else if ((at == removeAction) && (lengthData == 2)) { +                if ((position + lengthData * 2) == actPrevious.position) { +                    ; // Backspace -> OK +                } else if (position == actPrevious.position) { +                    ; // Delete -> OK +                } else { +				    // Removals must be at same position to coalesce +				    currentAction++; +                }  			} else {  				//Platform::DebugPrintf("action coalesced\n");  			} diff --git a/src/Editor.cxx b/src/Editor.cxx index 1ea5d17e4..c638ca5b3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1568,9 +1568,9 @@ void Editor::ClearSelection() {  		unsigned int chars = SelectionEnd() - startPos;  		SetEmptySelection(startPos);  		if (0 != chars) { -           	pdoc->EndUndoAction(); -			pdoc->DeleteChars(startPos, chars);             	pdoc->BeginUndoAction(); +			pdoc->DeleteChars(startPos, chars); +           	pdoc->EndUndoAction();  		}  	}  } | 
