diff options
author | Thomas <tschneider.ac@gmail.com> | 2023-09-11 11:03:07 +0200 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2023-09-11 11:03:07 +0200 |
commit | 14127fd203bc428a39e42965948cfad75fe20906 (patch) | |
tree | 6b0858efdafe3da8ea30d4841ba3accb4bc6e723 | |
parent | ac6d9f430ef2aee9628411040408427f961e6590 (diff) | |
parent | b6659de48367910ebc92193dcdf55b8de457b6c5 (diff) |
Merge branch 'fix_500' into develop
-rw-r--r-- | app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index f176f4498..ce1227e56 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -1642,9 +1642,11 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder lenght += ("#" + tag + " ").length(); } holder.binding.content.setText(statusDraft.text); - statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3; - statusDraft.setCursorToEnd = false; - holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3); + if (statusDraft.text.length() - lenght - 3 >= 0) { + statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3; + statusDraft.setCursorToEnd = false; + holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3); + } } } else if (forwardTag && position > 0 && statusDraft.text != null && statusDraft.text.contains("#") && !statusList.get(position).tagAdded) { Status status = statusList.get(position - 1).reblog == null ? statusList.get(position - 1) : statusList.get(position - 1).reblog; @@ -1672,9 +1674,11 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder for (String tag : camelCaseTags) { lenght += ("#" + tag + " ").length(); } - statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3; - statusDraft.setCursorToEnd = false; - holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3); + if (statusDraft.text.length() - lenght - 3 >= 0) { + statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3; + statusDraft.setCursorToEnd = false; + holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3); + } } } |