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

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 12238002: Views Textfield: Copy on Ctrl+Insert, fix and disable overtype. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Expand unit tests. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/textfield/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 model_->Backspace(); 1078 model_->Backspace();
1079 else 1079 else
1080 model_->Delete(); 1080 model_->Delete();
1081 1081
1082 // We have to consume the backspace/delete keys here even if the edit 1082 // We have to consume the backspace/delete keys here even if the edit
1083 // did not make effects. This is to prevent further handling of the key 1083 // did not make effects. This is to prevent further handling of the key
1084 // event that might have unintended side-effects. 1084 // event that might have unintended side-effects.
1085 text_changed = true; 1085 text_changed = true;
1086 break; 1086 break;
1087 case ui::VKEY_INSERT: 1087 case ui::VKEY_INSERT:
1088 GetRenderText()->ToggleInsertMode(); 1088 if (control && !shift)
1089 cursor_changed = true; 1089 Copy();
1090 else if (shift && !control)
1091 cursor_changed = text_changed = Paste();
1090 break; 1092 break;
1091 default: 1093 default:
1092 break; 1094 break;
1093 } 1095 }
1094 1096
1095 // We must have input method in order to support text input. 1097 // We must have input method in order to support text input.
1096 DCHECK(textfield_->GetInputMethod()); 1098 DCHECK(textfield_->GetInputMethod());
1097 1099
1098 UpdateAfterChange(text_changed, cursor_changed); 1100 UpdateAfterChange(text_changed, cursor_changed);
1099 OnAfterUserAction(); 1101 OnAfterUserAction();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 // Filter out all control characters, including tab and new line characters, 1295 // Filter out all control characters, including tab and new line characters,
1294 // and all characters with Alt modifier. But we need to allow characters with 1296 // and all characters with Alt modifier. But we need to allow characters with
1295 // AltGr modifier. 1297 // AltGr modifier.
1296 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1298 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1297 // flag that we don't care about. 1299 // flag that we don't care about.
1298 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1300 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1299 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1301 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1300 } 1302 }
1301 1303
1302 } // namespace views 1304 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698