From 82c6eb7b42e30a8dac01573be3d71914a9bb4150 Mon Sep 17 00:00:00 2001 From: nightfox <> Date: Sat, 7 Sep 2013 15:40:34 +0000 Subject: [PATCH] SlyEdit v1.31 - Bug fix: Set a default for the inner text for the text replacement list box in case it's not defined in the color theme file. Also did some small code refactoring. --- exec/SlyEdit.js | 8 ++++++-- exec/SlyEdit_Misc.js | 26 +++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index ad995c1086..98254de6e5 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -43,6 +43,10 @@ * lowercase the replacement text when in literal * match & replace mode. It will now take the * replacement text as-is. + * 2013-09-07 Eric Oulashin Version 1.31 + * Bug fix: Updated ReadSlyEditConfigFile() to + * default cfgObj.genColors.txtReplacementList to + * ensure that it gets defined. */ /* Command-line arguments: @@ -115,8 +119,8 @@ if (!console.term_supports(USER_ANSI)) } // Constants -const EDITOR_VERSION = "1.30"; -const EDITOR_VER_DATE = "2013-09-03"; +const EDITOR_VERSION = "1.31"; +const EDITOR_VER_DATE = "2013-09-07"; // Program variables diff --git a/exec/SlyEdit_Misc.js b/exec/SlyEdit_Misc.js index 78449a5c17..1450b7cd75 100644 --- a/exec/SlyEdit_Misc.js +++ b/exec/SlyEdit_Misc.js @@ -44,7 +44,9 @@ * that macro text replacements won't lowercase the * replacement text when in literal match & replace * mode. - * + * 2013-09-07 Eric Oulashin Bug fix: Updated ReadSlyEditConfigFile() to + * default cfgObj.genColors.txtReplacementList to + * ensure that it gets defined. */ // Note: These variables are declared with "var" instead of "const" to avoid @@ -658,6 +660,7 @@ function ReadSlyEditConfigFile() cfgObj.genColors.msgAbortedText = "nmh"; cfgObj.genColors.emptyMsgNotSentText = "nmh"; cfgObj.genColors.genMsgErrorText = "nmh"; + cfgObj.genColors.txtReplacementList = "nc"; // Default Ice-style colors cfgObj.iceColors = new Object(); @@ -2303,6 +2306,7 @@ function populateTxtReplacements(pArray, pRegex) var fileLine = null; // A line read from the file var equalsPos = 0; // Position of a = in the line var wordToSearch = null; // A word to be replaced + var wordToSearchUpper = null; var substWord = null; // The word to substitue // This tests numTxtReplacements < 9999 so that the 9999th one is the last // one read. @@ -2332,6 +2336,7 @@ function populateTxtReplacements(pArray, pRegex) // not using regular expressions, then convert the word to search to // all uppercase for case-insensitive searching. wordToSearch = trimSpaces(fileLine.substr(0, equalsPos), true, false, true); + wordToSearchUpper = wordToSearch.toUpperCase(); substWord = strip_ctrl(trimSpaces(fileLine.substr(equalsPos+1), true, false, true)); // Make sure substWord only contains printable characters. If not, then // skip this one. @@ -2342,22 +2347,13 @@ function populateTxtReplacements(pArray, pRegex) continue; // And add the search word and replacement text to pArray. - if (pRegex) + if (wordToSearchUpper != substWord.toUpperCase()) { - if (wordToSearch.toUpperCase() != substWord.toUpperCase()) - { + if (pRegex) pArray[wordToSearch] = substWord; - ++numTxtReplacements; - } - } - else - { - wordToSearch = wordToSearch.toUpperCase(); - if (wordToSearch != substWord.toUpperCase()) - { - pArray[wordToSearch] = substWord; - ++numTxtReplacements; - } + else + pArray[wordToSearchUpper] = substWord; + ++numTxtReplacements; } } -- GitLab