From e5516749ed5e53e1b835bb7867fe04098adfab93 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 5 Dec 2017 20:56:42 +0100 Subject: [PATCH] stop cursor from jumping when upload finishes while composing toot --- .../main/java/com/keylesspalace/tusky/ComposeActivity.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 1ac3d196a..64ee247c7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -1307,10 +1307,9 @@ public final class ComposeActivity extends BaseActivity builder.append(media.textUrl); builder.setSpan(item.uploadUrl, 1, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); int cursorStart = textEditor.getSelectionStart(); + int cursorEnd = textEditor.getSelectionEnd(); textEditor.append(builder); - if (cursorStart == textEditor.getText().length()) { - textEditor.setSelection(cursorStart); - } + textEditor.setSelection(cursorStart, cursorEnd); waitForMediaLatch.countDown(); }