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
1=== modified file 'plugins/unityshell/src/IMTextEntry.cpp'
2--- plugins/unityshell/src/IMTextEntry.cpp 2011-08-31 20:22:39 +0000
3+++ plugins/unityshell/src/IMTextEntry.cpp 2011-09-07 17:07:59 +0000
4@@ -236,7 +236,9 @@
5 DeleteSelection();
6 if (str)
7 {
8- std::string new_text = GetText() + str;
9+ std::string new_text = GetText();
10+ new_text.insert(cursor_, str);
11+
12 int cursor = cursor_;
13 SetText(new_text.c_str());
14 SetCursor(cursor + strlen(str));