Added fail-safe

pull/214/head
M66B 2 years ago
parent a4d6f1403c
commit f3ab891806

@ -123,22 +123,26 @@ public class EditTextCompose extends FixedEditText {
@Override @Override
public void onTextChanged(CharSequence text, int start, int before, int count) { public void onTextChanged(CharSequence text, int start, int before, int count) {
int index = start + before; try {
if (count - before == 1 && index > 1) { int index = start + before;
char c = text.charAt(index); if (count - before == 1 && index > 1) {
if (c == '>' && char c = text.charAt(index);
text.charAt(index - 1) == '-' && if (c == '>' &&
text.charAt(index - 2) == '-') { text.charAt(index - 1) == '-' &&
replace = index - 2; text.charAt(index - 2) == '-') {
length = 3; replace = index - 2;
what = "→"; length = 3;
} else if (c == '-' && what = "→";
text.charAt(index - 1) == '-' && } else if (c == '-' &&
text.charAt(index - 2) == '<') { text.charAt(index - 1) == '-' &&
replace = index - 2; text.charAt(index - 2) == '<') {
length = 3; replace = index - 2;
what = "←"; length = 3;
what = "←";
}
} }
} catch (Throwable ex) {
Log.e(ex);
} }
} }

Loading…
Cancel
Save