Merge pull request #175 from one-some/token-streaming-newline-fix

Fix arbitrary newline insertion when token streaming is enabled
This commit is contained in:
henk717 2022-07-31 01:22:15 +02:00 committed by GitHub
commit 56783a1257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -2351,7 +2351,12 @@ $(document).ready(function(){
var element = game_text.children('#n' + index); var element = game_text.children('#n' + index);
if(element.length) { if(element.length) {
unbindGametext(); unbindGametext();
if((element[0].nextSibling === null || element[0].nextSibling.nodeType !== 1 || element[0].nextSibling.tagName !== "CHUNK") && element[0].previousSibling !== null && element[0].previousSibling.tagName === "CHUNK") { if(
(element[0].nextSibling === null || element[0].nextSibling.nodeType !== 1 || element[0].nextSibling.tagName !== "CHUNK")
&& element[0].previousSibling !== null
&& element[0].previousSibling.tagName === "CHUNK"
&& !$("#setoutputstreaming")[0].checked
) {
element[0].previousSibling.appendChild(document.createElement("br")); element[0].previousSibling.appendChild(document.createElement("br"));
} }
element.remove(); // Remove the chunk element.remove(); // Remove the chunk