Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: Source/core/editing/TypingCommand.cpp

Issue 43143003: Undo of delete/forward-delete of text should not select the deleted text on non-mac platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/TypingCommand.cpp
diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp
index 596265bf2d16b171d3a52dfcd39a28fb315175c2..c2d8ba7845becb8f9b9daa9b96f990fd61e23767 100644
--- a/Source/core/editing/TypingCommand.cpp
+++ b/Source/core/editing/TypingCommand.cpp
@@ -484,10 +484,10 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
if (killRing)
frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
- // Make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
+ // On Mac, make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
// FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete
// more text than you insert. In that case all of the text that was around originally should be selected.
- if (m_openedByBackwardDelete)
+ if (frame->editor().behavior().shouldUndoOfWordDeletionSelectWord() && m_openedByBackwardDelete)
setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
@@ -577,8 +577,9 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki
if (killRing)
frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
- // make undo select what was deleted
- setStartingSelection(selectionAfterUndo);
+ // Make undo select what was deleted on Mac alone
+ if (frame->editor().behavior().shouldUndoOfWordDeletionSelectWord())
+ setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
typingAddedToOpenCommand(ForwardDeleteKey);
« Source/core/editing/EditingBehavior.h ('K') | « Source/core/editing/EditingBehavior.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698