Merge pull request #163 from VE-FORBRYDERNE/whitespace-cleanup
More story whitespace cleanup
This commit is contained in:
commit
8cea194809
|
@ -3495,6 +3495,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
|
||||||
if(not vars.gamestarted):
|
if(not vars.gamestarted):
|
||||||
vars.submission = data
|
vars.submission = data
|
||||||
execute_inmod()
|
execute_inmod()
|
||||||
|
vars.submission = re.sub(r"[^\S\r\n]*([\r\n]*)$", r"\1", vars.submission) # Remove trailing whitespace, excluding newlines
|
||||||
data = vars.submission
|
data = vars.submission
|
||||||
if(not force_submit and len(data.strip()) == 0):
|
if(not force_submit and len(data.strip()) == 0):
|
||||||
assert False
|
assert False
|
||||||
|
@ -3553,6 +3554,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
|
||||||
data = applyinputformatting(data)
|
data = applyinputformatting(data)
|
||||||
vars.submission = data
|
vars.submission = data
|
||||||
execute_inmod()
|
execute_inmod()
|
||||||
|
vars.submission = re.sub(r"[^\S\r\n]*([\r\n]*)$", r"\1", vars.submission) # Remove trailing whitespace, excluding newlines
|
||||||
data = vars.submission
|
data = vars.submission
|
||||||
# Dont append submission if it's a blank/continue action
|
# Dont append submission if it's a blank/continue action
|
||||||
if(data != ""):
|
if(data != ""):
|
||||||
|
|
|
@ -891,6 +891,7 @@ function dosubmit(disallow_abort) {
|
||||||
if((disallow_abort || gamestate !== "wait") && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) {
|
if((disallow_abort || gamestate !== "wait") && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
chunkOnFocusOut("override");
|
||||||
input_text.val("");
|
input_text.val("");
|
||||||
hideMessage();
|
hideMessage();
|
||||||
hidegenseqs();
|
hidegenseqs();
|
||||||
|
@ -1969,7 +1970,7 @@ function chunkOnKeyDownSelectionChange(event) {
|
||||||
// This gets run when you defocus the editor by clicking
|
// This gets run when you defocus the editor by clicking
|
||||||
// outside of the editor or by pressing escape or tab
|
// outside of the editor or by pressing escape or tab
|
||||||
function chunkOnFocusOut(event) {
|
function chunkOnFocusOut(event) {
|
||||||
if(!gametext_bound || !allowedit || event.target !== game_text[0]) {
|
if(event !== "override" && (!gametext_bound || !allowedit || event.target !== game_text[0])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<script src="static/bootstrap.min.js"></script>
|
<script src="static/bootstrap.min.js"></script>
|
||||||
<script src="static/bootstrap-toggle.min.js"></script>
|
<script src="static/bootstrap-toggle.min.js"></script>
|
||||||
<script src="static/rangy-core.min.js"></script>
|
<script src="static/rangy-core.min.js"></script>
|
||||||
<script src="static/application.js?ver=1.18.1d"></script>
|
<script src="static/application.js?ver=1.18.1e"></script>
|
||||||
<script src="static/favicon.js"></script>
|
<script src="static/favicon.js"></script>
|
||||||
{% if flaskwebgui %}
|
{% if flaskwebgui %}
|
||||||
<script src="static/flask_web_gui.js"></script>
|
<script src="static/flask_web_gui.js"></script>
|
||||||
|
|
3
utils.py
3
utils.py
|
@ -104,6 +104,9 @@ def removespecialchars(txt, vars=None):
|
||||||
# If the next action follows a sentence closure, add a space
|
# If the next action follows a sentence closure, add a space
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
def addsentencespacing(txt, vars):
|
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
|
# Get last character of last action
|
||||||
if(len(vars.actions) > 0):
|
if(len(vars.actions) > 0):
|
||||||
if(len(vars.actions[vars.actions.get_last_key()]) > 0):
|
if(len(vars.actions[vars.actions.get_last_key()]) > 0):
|
||||||
|
|
Loading…
Reference in New Issue