Move trimToEnd at the end of message clean-up

87dd120ec0782e0bcec21f0e6ea78d5d62cbe4d0

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -7Showing whitespace changes
public/script.js+8 -7
@@ -5345,17 +5345,10 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
53455345 // Regex uses vars, so add before formatting
53465346 getMessage = getRegexedString(getMessage, isImpersonate ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT);
53475347
5348- if (!displayIncompleteSentences && power_user.trim_sentences) {
5349- getMessage = trimToEndSentence(getMessage, power_user.include_newline);
5350- }
5351-
53525348 if (power_user.collapse_newlines) {
53535349 getMessage = collapseNewlines(getMessage);
53545350 }
53555351
5356- if (power_user.trim_spaces) {
5357- getMessage = getMessage.trim();
5358- }
53595352 // trailing invisible whitespace before every newlines, on a multiline string
53605353 // "trailing whitespace on newlines \nevery line of the string \n?sample text" ->
53615354 // "trailing whitespace on newlines\nevery line of the string\nsample text"
@@ -5447,6 +5440,14 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
54475440 getMessage = getMessage.trim();
54485441 }
54495442
5443+ if (!displayIncompleteSentences && power_user.trim_sentences) {
5444+ getMessage = trimToEndSentence(getMessage, power_user.include_newline);
5445+ }
5446+
5447+ if (power_user.trim_spaces) {
5448+ getMessage = getMessage.trim();
5449+ }
5450+
54505451 return getMessage;
54515452}
54525453