diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-08-31 17:40:29 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-08-31 17:40:29 +0200 |
commit | 4793081c2c89c669241f7f4998d7c745e03f49e3 (patch) | |
tree | 2a0ca59e293dca85165cb9d2496b719a88a98874 /src | |
parent | 1ac5be485502e7d6d4c117335e083c684739e6af (diff) | |
parent | 3e3451bcffb56740f46d447aaa0356b81ca573c7 (diff) |
Merge pull request #400 from xsrc/development
Smarter nickname highlight insert in confernces
Diffstat (limited to 'src')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 9309db9c..f4af7277 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -287,14 +287,11 @@ public class ConversationFragment extends Fragment { protected void highlightInConference(String nick) { String oldString = mEditMessage.getText().toString().trim(); - if (oldString.isEmpty()) { - mEditMessage.setText(nick + ": "); + if (oldString.isEmpty() || mEditMessage.getSelectionStart() == 0) { + mEditMessage.getText().insert(0, nick + ": "); } else { - mEditMessage.setText(oldString + " " + nick + " "); + mEditMessage.getText().insert(mEditMessage.getSelectionStart(), nick + " "); } - int position = mEditMessage.length(); - Editable etext = mEditMessage.getText(); - Selection.setSelection(etext, position); } @Override |