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

Unified Diff: ui/views/controls/textfield/textfield_model.h

Issue 2119813002: views::Textfield: Implement yank editing command. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 5 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: ui/views/controls/textfield/textfield_model.h
diff --git a/ui/views/controls/textfield/textfield_model.h b/ui/views/controls/textfield/textfield_model.h
index df3e9754e2d52c1e51949b542cf3d2552c56dfc4..e63072b6d4bf7a2b0349bc9a02c9e50b60b2a751 100644
--- a/ui/views/controls/textfield/textfield_model.h
+++ b/ui/views/controls/textfield/textfield_model.h
@@ -95,15 +95,17 @@ class VIEWS_EXPORT TextfieldModel {
// Deletes the first character after the current cursor position (as if, the
// the user has pressed delete key in the textfield). Returns true if
- // the deletion is successful.
+ // the deletion is successful. If |add_to_kill_buffer| is true, the deleted
+ // text is copied to the kill buffer.
// If there is composition text, it'll be deleted instead.
- bool Delete();
+ bool Delete(bool add_to_kill_buffer = false);
msw 2016/07/22 17:44:03 I thought chromium generally discouraged default p
// Deletes the first character before the current cursor position (as if, the
// the user has pressed backspace key in the textfield). Returns true if
- // the removal is successful.
+ // the removal is successful. If |add_to_kill_buffer| is true, the deleted
+ // text is copied to the kill buffer.
// If there is composition text, it'll be deleted instead.
- bool Backspace();
+ bool Backspace(bool add_to_kill_buffer = false);
// Cursor related methods.
@@ -182,6 +184,10 @@ class VIEWS_EXPORT TextfieldModel {
// changed.
bool Transpose();
+ // Pastes text from the kill buffer at the current cursor position or
+ // selection.
msw 2016/07/22 17:44:03 nit: What does "or selection" mean? Just that a cu
karandeepb 2016/07/25 06:38:11 Done. Yeah it follows the standard paste behavior.
+ bool Yank();
+
// Tells if any text is selected, even if the selection is in composition
// text.
bool HasSelection() const;
@@ -223,6 +229,9 @@ class VIEWS_EXPORT TextfieldModel {
// Clears all edit history.
void ClearEditHistory();
+ // Clears the kill buffer. Exposed to clear global state between tests.
+ static void ClearKillBufferForTesting();
sky 2016/07/22 15:22:49 How about friending the helper and moving this to
karandeepb 2016/07/25 06:38:11 Done. But friending BridgedNativeWidgetTest here s
sky 2016/07/25 15:26:27 Another option is to friend a class that is used b
+
private:
friend class internal::Edit;

Powered by Google App Engine
This is Rietveld 408576698