Lines Matching defs:edit

1108             // Don't leave us in the middle of a batch edit.
1215 // Don't leave us in the middle of a batch edit. Same as in onFocusChanged
2288 // The input is in extract mode. Do not handle the easy edit in
5111 // Whether the current filter pass is directly caused by an end-user text edit.
5133 * Signals that a user-triggered edit is starting.
5153 // Check to see if this edit should be tracked for undo.
5169 * Returns true iff the edit was handled, either because it should be ignored or because
5183 // If there was no text the user canceled composition. Ignore the edit.
5190 EditOperation edit = new EditOperation(mEditor, "", dstart, newText);
5191 recordEdit(edit, false /* forceMerge */);
5207 // Build a new operation with all the information from this edit.
5210 EditOperation edit = new EditOperation(mEditor, oldText, dstart, newText);
5211 recordEdit(edit, forceMerge);
5215 * Fetches the last undo operation and checks to see if a new edit should be merged into it.
5216 * If forceMerge is true then the new edit is always merged.
5218 private void recordEdit(EditOperation edit, boolean forceMerge) {
5219 // Fetch the last edit operation and attempt to merge in the new edit.
5225 // Add this as the first edit.
5226 if (DEBUG_UNDO) Log.d(TAG, "filter: adding first op " + edit);
5227 um.addOperation(edit, UndoManager.MERGE_MODE_NONE);
5229 // Forced merges take priority because they could be the result of a non-user-edit
5231 if (DEBUG_UNDO) Log.d(TAG, "filter: force merge " + edit);
5232 lastEdit.forceMergeWith(edit);
5234 // An application directly modified the Editable outside of a text edit. Treat this
5236 if (DEBUG_UNDO) Log.d(TAG, "non-user edit, new op " + edit);
5238 um.addOperation(edit, UndoManager.MERGE_MODE_NONE);
5239 } else if (lastEdit.mergeWith(edit)) {
5243 // Could not merge with the last edit, so commit the last edit and add this edit.
5244 if (DEBUG_UNDO) Log.d(TAG, "filter: merge failed, adding " + edit);
5246 um.addOperation(edit, UndoManager.MERGE_MODE_NONE);
5285 // This is a composition edit if the source has a non-zero-length composing span.
5300 * An operation to undo a single "edit" to a text view.
5317 * Constructs an edit operation from a text input operation on editor that replaces the
5325 // Determine the type of the edit and store where it occurred. Avoid storing
5400 * Attempts to merge this existing operation with a new edit.
5401 * @param edit The new edit operation.
5405 private boolean mergeWith(EditOperation edit) {
5408 Log.d(TAG, "mergeWith new " + edit);
5412 return mergeInsertWith(edit);
5414 return mergeDeleteWith(edit);
5416 return mergeReplaceWith(edit);
5422 private boolean mergeInsertWith(EditOperation edit) {
5424 if (edit.mType != TYPE_INSERT) {
5428 if (getNewTextEnd() != edit.mNewTextStart) {
5431 mNewText += edit.mNewText;
5432 mNewCursorPos = edit.mNewCursorPos;
5437 private boolean mergeDeleteWith(EditOperation edit) {
5439 if (edit.mType != TYPE_DELETE) {
5443 if (mOldTextStart != edit.getOldTextEnd()) {
5446 mOldTextStart = edit.mOldTextStart;
5447 mOldText = edit.mOldText + mOldText;
5448 mNewCursorPos = edit.mNewCursorPos;
5452 private boolean mergeReplaceWith(EditOperation edit) {
5454 if (edit.mType != TYPE_INSERT || getNewTextEnd() != edit.mNewTextStart) {
5457 mOldText += edit.mOldText;
5458 mNewText += edit.mNewText;
5459 mNewCursorPos = edit.mNewCursorPos;
5464 * Forcibly creates a single merged edit operation by simulating the entire text
5467 public void forceMergeWith(EditOperation edit) {
5484 modifyText(finalText, edit.mOldTextStart, edit.getOldTextEnd(), edit.mNewText,
5485 edit.mNewTextStart, edit.mNewCursorPos);
5493 mNewCursorPos = edit.mNewCursorPos;
5499 // Apply the edit if it is still valid.