Don't skip ephemeral stop strings if there are no custom stop strings

This commit is contained in:
Cohee
2023-12-01 17:18:30 +02:00
parent 8797508aa3
commit bb9d302c3a

View File

@@ -2209,11 +2209,7 @@ function getStoppingStrings(isImpersonate, isContinue) {
} }
result.push(...getInstructStoppingSequences()); result.push(...getInstructStoppingSequences());
result.push(...getCustomStoppingStrings());
if (power_user.custom_stopping_strings) {
const customStoppingStrings = getCustomStoppingStrings();
result.push(...customStoppingStrings);
}
if (power_user.single_line) { if (power_user.single_line) {
result.unshift('\n'); result.unshift('\n');
@@ -9382,12 +9378,12 @@ jQuery(async function () {
$(this).val(myText); // trim line breaks and spaces $(this).val(myText); // trim line breaks and spaces
const masterSelector = $(this).data('for'); const masterSelector = $(this).data('for');
const masterElement = document.getElementById(masterSelector); const masterElement = document.getElementById(masterSelector);
if (masterElement == null) { if (masterElement == null) {
console.error('Master input element not found for the editable label', masterSelector); console.error('Master input element not found for the editable label', masterSelector);
return; return;
} }
const myValue = Number(myText); const myValue = Number(myText);
const masterStep = Number(masterElement.getAttribute('step')) const masterStep = Number(masterElement.getAttribute('step'))
const masterMin = Number($(masterElement).attr('min')); const masterMin = Number($(masterElement).attr('min'));
@@ -9395,14 +9391,14 @@ jQuery(async function () {
const rawStepCompare = myValue / masterStep const rawStepCompare = myValue / masterStep
const closestStep = Math.round(rawStepCompare) const closestStep = Math.round(rawStepCompare)
const closestStepRaw = (closestStep) * masterStep const closestStepRaw = (closestStep) * masterStep
//yolo anything for Lab Mode //yolo anything for Lab Mode
if (power_user.enableLabMode) { if (power_user.enableLabMode) {
//console.log($(masterElement).attr('id'), myValue) //console.log($(masterElement).attr('id'), myValue)
$(masterElement).val(myValue).trigger('input') $(masterElement).val(myValue).trigger('input')
return return
} }
//if text box val is not a number, reset slider val to its previous and wait for better input //if text box val is not a number, reset slider val to its previous and wait for better input
if (Number.isNaN(myValue)) { if (Number.isNaN(myValue)) {
console.warn('Label input is not a valid number. Resetting the value to match slider', myText); console.warn('Label input is not a valid number. Resetting the value to match slider', myText);
@@ -9410,7 +9406,7 @@ jQuery(async function () {
restoreCaretPosition($(this).get(0), caretPosition); restoreCaretPosition($(this).get(0), caretPosition);
return; return;
} }
//if textbox val is less than min, set slider to min //if textbox val is less than min, set slider to min
//PROBLEM: the moment slider gets set to min, textbox also auto-sets to min. //PROBLEM: the moment slider gets set to min, textbox also auto-sets to min.
//if min = 0, this prevents further typing and locks input at 0 unless users pastes //if min = 0, this prevents further typing and locks input at 0 unless users pastes
@@ -9431,7 +9427,7 @@ jQuery(async function () {
restoreCaretPosition($(this).get(0), caretPosition); restoreCaretPosition($(this).get(0), caretPosition);
return; return;
} }
//round input value to nearest step if between min and max //round input value to nearest step if between min and max
if (!(myValue < masterMin) && !(myValue > masterMax)) { if (!(myValue < masterMin) && !(myValue > masterMax)) {
console.debug(`Label value ${myText} is OK, setting slider to closest step (${closestStepRaw})`); console.debug(`Label value ${myText} is OK, setting slider to closest step (${closestStepRaw})`);
@@ -9439,7 +9435,7 @@ jQuery(async function () {
restoreCaretPosition($(this).get(0), caretPosition); restoreCaretPosition($(this).get(0), caretPosition);
return; return;
} }
restoreCaretPosition($(this).get(0), caretPosition); restoreCaretPosition($(this).get(0), caretPosition);
}, 2000); */ }, 2000); */
//}); //});