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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 386032: Mac: Let arrow keys move caret in IME mode. (Closed)
Patch Set: address comments Created 11 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 5a187d3940d0a4c778b385c5be15eec624ad3655..1c5469cb91f23299042c3d0a3e43293f4107ed24 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1280,22 +1280,21 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
NSString* im_text = isAttributedString ? [string string] : string;
int length = [im_text length];
- int cursor;
+ int cursor = newSelRange.location;
+
int target_start;
int target_end;
if (!newSelRange.length) {
- // The given text doesn't have any range to be highlighted.
- // Put the cursor to the end of this text and clear the selection range.
- cursor = length;
+ // The given text doesn't have any range to be highlighted. Clear the
+ // selection range.
target_start = 0;
target_end = 0;
} else {
// The given text has a range to be highlighted.
// Set the selection range to the given one and put the cursor at the
// beginning of the selection range.
- cursor = newSelRange.location;
target_start = newSelRange.location;
- target_end = newSelRange.location + newSelRange.length;
+ target_end = NSMaxRange(newSelRange);
}
// Dispatch this IME event to the renderer and update the IME state of this
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698