From 6ba7429eead8a3f882b5fb7949ffb7157949cf37 Mon Sep 17 00:00:00 2001 From: vfbd Date: Sun, 26 Jun 2022 14:06:18 -0400 Subject: [PATCH] Don't add sentence spacing if submission is empty When you retry, it actually sends an empty submission, so if you have add sentence spacing on, retrying could add an extra action with a single space. (cherry picked from commit 151407a001651c70f49a0c659957d80a36ec2a8a) --- utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils.py b/utils.py index 96606269..e6d7d12b 100644 --- a/utils.py +++ b/utils.py @@ -91,6 +91,9 @@ def removespecialchars(txt, vars=None): # If the next action follows a sentence closure, add a space #==================================================================# def addsentencespacing(txt, vars): + # Don't add sentence spacing if submission is empty or starts with whitespace + if(len(txt) == 0 or len(txt) != len(txt.lstrip())): + return txt # Get last character of last action if(len(vars.actions) > 0): if(len(vars.actions[vars.actions.get_last_key()]) > 0):