From d920b02e698fcdf7ea3edcd2c4086670a5c6e83f Mon Sep 17 00:00:00 2001 From: tom79 Date: Wed, 29 May 2019 17:48:46 +0200 Subject: [PATCH] remove an issue --- .../fedilab/android/activities/TootActivity.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/TootActivity.java b/app/src/main/java/app/fedilab/android/activities/TootActivity.java index 56ea77dd2..edf6fd4ff 100644 --- a/app/src/main/java/app/fedilab/android/activities/TootActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/TootActivity.java @@ -732,9 +732,16 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface, } else { searchLength = 15; } + + + int totalChar = countLength(); + toot_space_left.setText(String.valueOf(totalChar)); + if (currentCursorPosition - (searchLength - 1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length()) + return; + String patternh = "^(.|\\s)*(:fedilab_hugs:)$"; final Pattern hPattern = Pattern.compile(patternh); - Matcher mh = hPattern.matcher(s.toString()); + Matcher mh = hPattern.matcher((s.toString().substring(currentCursorPosition - searchLength, currentCursorPosition))); if (mh.matches()) { autocomplete = true; @@ -742,10 +749,6 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface, return; } - int totalChar = countLength(); - toot_space_left.setText(String.valueOf(totalChar)); - if (currentCursorPosition - (searchLength - 1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length()) - return; Matcher m, mt; if (s.toString().charAt(0) == '@') m = sPattern.matcher(s.toString().substring(currentCursorPosition - searchLength, currentCursorPosition));