Insert space before snippets

This commit is contained in:
M66B 2022-03-14 10:53:42 +01:00
parent e99633b742
commit eac24e3861
1 changed files with 11 additions and 1 deletions

View File

@ -235,7 +235,17 @@ public class EditTextCompose extends FixedEditText {
int start = getSelectionStart();
if (start < 0)
start = 0;
getText().insert(start, ssb);
Editable edit = getText();
if (start > 0) {
char kar = edit.charAt(start - 1);
if (!(kar == '\n' || kar == ' '))
edit.insert(start++, " ");
}
edit.insert(start, ssb);
setSelection(start + ssb.length());
} catch (Throwable ex) {
Log.e(ex);