From b615d1350daee1e4218caa0342a058e43a2cbba9 Mon Sep 17 00:00:00 2001 From: Michael Rowley Date: Sat, 13 Aug 2022 17:41:59 +0100 Subject: [PATCH] Fixed parsing bug This issue was one where custom headers that consisted of digits and were less than three characters long could be mistaken for standard headers when being edited again. --- src/web/waiters/InputWaiter.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index fcc40179..021a626a 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -1471,15 +1471,15 @@ class InputWaiter { renameContents = renameContents.substring(0, renameContentsColon); } - // Remove the single quotation marks from the renaming section - renameContents = renameContents.replaceAll("'", ""); - - if (renameContents.length < 3 && !isNaN(parseInt(renameContents, 10))) { + // Restore the full header if it hasn't been renamed + if (renameContents.indexOf("'") === -1 && !isNaN(parseInt(renameContents, 10))) { renameContents = `Tab ${renameContents.toString()}`; } + // Remove the single quotation marks from the renaming section + renameContents = renameContents.replaceAll("'", ""); + editingElement.setAttribute("value", renameContents); - editingElement.setAttribute("minlength", "3"); // Delimiting between shortened tab headers and custom ones. targetElement.textContent = ""; editingElement.style.height = "1.5em"; editingElement.style.textAlign = "center";