Skip to content

Commit

Permalink
Fix incorrect auto space check for empty field
Browse files Browse the repository at this point in the history
  • Loading branch information
abb128 committed Jan 6, 2025
1 parent 780ead1 commit 2ae175b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,9 @@ private void handleSeparatorEvent(final Event event, final InputTransaction inpu
}
}

final boolean fieldEmptyBeforeText =
(mConnection.getCodePointBeforeCursor() == Constants.NOT_A_CODE);

sendKeyCodePoint(settingsValues, codePoint);

boolean codeShouldBeFollowedBySpace = false;
Expand All @@ -1138,8 +1141,7 @@ private void handleSeparatorEvent(final Event event, final InputTransaction inpu
// Do not automatically insert a space if there is no text preceding the cursor
// (e.g. if we are typing "!g", do not insert space after exclamation mark,
// and if we are typing ":)", do not insert space after colon)
codeShouldBeFollowedBySpace = codeShouldBeFollowedBySpace
&& (mConnection.getCodePointBeforeCursor() != Constants.NOT_A_CODE);
codeShouldBeFollowedBySpace = codeShouldBeFollowedBySpace && !fieldEmptyBeforeText;

if(autoInsertSpaces && codeShouldBeFollowedBySpace) {
insertOrSetPhantomSpace(settingsValues);
Expand Down

0 comments on commit 2ae175b

Please sign in to comment.