Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/base/ime/input_method_ibus.h" | 5 #include "ui/base/ime/input_method_ibus.h" |
| 6 | 6 |
| 7 #include <X11/X.h> | 7 #include <X11/X.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #undef FocusIn | 10 #undef FocusIn |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 return; | 260 return; |
| 261 } | 261 } |
| 262 | 262 |
| 263 if (previous_selection_range_ == selection_range && | 263 if (previous_selection_range_ == selection_range && |
| 264 previous_surrounding_text_ == surrounding_text) | 264 previous_surrounding_text_ == surrounding_text) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 previous_selection_range_ = selection_range; | 267 previous_selection_range_ = selection_range; |
| 268 previous_surrounding_text_ = surrounding_text; | 268 previous_surrounding_text_ = surrounding_text; |
| 269 | 269 |
| 270 // In the original meaning of SetSurroundingText is not just selection text, | |
| 271 // but currently there are no way to retrieve surrounding text in | |
| 272 // TextInputClient. | |
| 273 GetInputContextClient()->SetSurroundingText( | 270 GetInputContextClient()->SetSurroundingText( |
| 274 UTF16ToUTF8(surrounding_text), | 271 UTF16ToUTF8(surrounding_text), |
| 275 selection_range.start(), /* cursor position. */ | 272 selection_range.start() - text_range.start(), // cursor position. |
| 276 selection_range.end()); /* selection anchor position. */ | 273 selection_range.end() - text_range.end()); // selection anchor position. |
|
kinaba
2013/04/10 04:12:35
Shouldn't it be text_range.start(), not the .end()
Seigo Nonaka
2013/04/10 04:22:26
Yes, good catch! thank you very much!
On 2013/04/1
| |
| 277 } | 274 } |
| 278 | 275 |
| 279 void InputMethodIBus::CancelComposition(const TextInputClient* client) { | 276 void InputMethodIBus::CancelComposition(const TextInputClient* client) { |
| 280 if (context_focused_ && IsTextInputClientFocused(client)) | 277 if (context_focused_ && IsTextInputClientFocused(client)) |
| 281 ResetContext(); | 278 ResetContext(); |
| 282 } | 279 } |
| 283 | 280 |
| 284 std::string InputMethodIBus::GetInputLocale() { | 281 std::string InputMethodIBus::GetInputLocale() { |
| 285 // Not supported. | 282 // Not supported. |
| 286 return ""; | 283 return ""; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 933 } | 930 } |
| 934 | 931 |
| 935 // Use a black thin underline by default. | 932 // Use a black thin underline by default. |
| 936 if (out_composition->underlines.empty()) { | 933 if (out_composition->underlines.empty()) { |
| 937 out_composition->underlines.push_back(CompositionUnderline( | 934 out_composition->underlines.push_back(CompositionUnderline( |
| 938 0, length, SK_ColorBLACK, false /* thick */)); | 935 0, length, SK_ColorBLACK, false /* thick */)); |
| 939 } | 936 } |
| 940 } | 937 } |
| 941 | 938 |
| 942 } // namespace ui | 939 } // namespace ui |
| OLD | NEW |