Remove trailing whitespace from submissions

This commit is contained in:
vfbd 2022-06-26 13:15:55 -04:00
parent 151407a001
commit b99d1449c9
1 changed files with 2 additions and 0 deletions

View File

@ -3495,6 +3495,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
if(not vars.gamestarted):
vars.submission = data
execute_inmod()
vars.submission = re.sub(r"[^\S\r\n]*([\r\n]*)$", r"\1", vars.submission) # Remove trailing whitespace, excluding newlines
data = vars.submission
if(not force_submit and len(data.strip()) == 0):
assert False
@ -3553,6 +3554,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
data = applyinputformatting(data)
vars.submission = data
execute_inmod()
vars.submission = re.sub(r"[^\S\r\n]*([\r\n]*)$", r"\1", vars.submission) # Remove trailing whitespace, excluding newlines
data = vars.submission
# Dont append submission if it's a blank/continue action
if(data != ""):