prevented tabs, vert tabs, line feeds and carriage returns.

This commit is contained in:
cmccabe 2019-12-24 11:28:03 +00:00
parent c8c10f16f6
commit 0f78499f70
1 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,7 @@
## system you're running it on. Or, feel free to sign up for a free
## rawtext.club account and help us build this and other tools!
##
## created originall by cmccabe@tilde.town - spring 2018-ish.
## created originally by cmccabe@tilde.town - spring 2018-ish.
## ported from asciimatics to python curses late 2019.
##
## WHAT?
@ -221,6 +221,8 @@ def validate_car(car):
for idx,row in enumerate(car):
if len(row) > max_x+1: ## check length of each row in .choochoo file.
return 0 ## train car too long; skip it.
elif "\t" in row or "\v" in row or "\f" in row or "\r" in row:
return 0 # skip if contains tabs, vert tabs, line feeds or carriage ret
elif len(row) < longest_line:
padding = " "*(longest_line - len(row))
car[idx] += padding ## add padding spaces.