Merge lp:~robertcarr/unity/imtextentry-cursor into lp:unity

Proposed by Robert Carr
Status: Merged
Approved by: Alex Launi
Approved revision: no longer in the source branch.
Merged at revision: 1506
Proposed branch: lp:~robertcarr/unity/imtextentry-cursor
Merge into: lp:unity
Diff against target: 14 lines (+3/-1)
1 file modified
plugins/unityshell/src/IMTextEntry.cpp (+3/-1)
To merge this branch: bzr merge lp:~robertcarr/unity/imtextentry-cursor
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Review via email: mp+74479@code.launchpad.net

Description of the change

When commiting IMContext changes we need to insert the text at the cursor position instead of just at the end.

To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/IMTextEntry.cpp'
--- plugins/unityshell/src/IMTextEntry.cpp 2011-08-31 20:22:39 +0000
+++ plugins/unityshell/src/IMTextEntry.cpp 2011-09-07 17:07:59 +0000
@@ -236,7 +236,9 @@
236 DeleteSelection();236 DeleteSelection();
237 if (str)237 if (str)
238 {238 {
239 std::string new_text = GetText() + str;239 std::string new_text = GetText();
240 new_text.insert(cursor_, str);
241
240 int cursor = cursor_;242 int cursor = cursor_;
241 SetText(new_text.c_str());243 SetText(new_text.c_str());
242 SetCursor(cursor + strlen(str));244 SetCursor(cursor + strlen(str));