From 53458cff77ac19b1c6dfecd42e534af903dd0bc0 Mon Sep 17 00:00:00 2001 From: nightfox <> Date: Wed, 4 Sep 2013 03:21:16 +0000 Subject: [PATCH] SlyEdit 1.30: When literal text replacements are being done (not using regular expressions), SlyEdit now won't force the replacement text to be all lower-case. --- exec/SlyEdit.js | 9 +++++++-- exec/SlyEdit_Misc.js | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index 5870c9ea22..ad995c1086 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -38,6 +38,11 @@ * list the text replacements will only work if * text replacements is enabled. * After some more testing, I decided to release 1.29 today. + * 2013-09-03 Eric Oulashin Version 1.30 + * Updated so that macro text replacements won't + * lowercase the replacement text when in literal + * match & replace mode. It will now take the + * replacement text as-is. */ /* Command-line arguments: @@ -110,8 +115,8 @@ if (!console.term_supports(USER_ANSI)) } // Constants -const EDITOR_VERSION = "1.29"; -const EDITOR_VER_DATE = "2013-09-02"; +const EDITOR_VERSION = "1.30"; +const EDITOR_VER_DATE = "2013-09-03"; // Program variables diff --git a/exec/SlyEdit_Misc.js b/exec/SlyEdit_Misc.js index 90e8b59355..78449a5c17 100644 --- a/exec/SlyEdit_Misc.js +++ b/exec/SlyEdit_Misc.js @@ -34,6 +34,16 @@ * which are helpers for doMacroTxtReplacementInEditLine() * for checking & fixing first-letter capitalization * after doing a regex replace. + * 2013-09-03 Eric Oulashin Updated populateTxtReplacements() so that it won't + * force the replacement text strings to lowercase + * when not using regular expressions. Also made + * use of strip_ctrl() with the replacement text to + * prevent the use of color codes, which might mess + * up SlyEdit's tracking of string indexes, etc. + * Updated doMacroTxtReplacementInEditLine() so + * that macro text replacements won't lowercase the + * replacement text when in literal match & replace + * mode. * */ @@ -2320,10 +2330,9 @@ function populateTxtReplacements(pArray, pRegex) // Extract the word to search and substitution word from the line. If // not using regular expressions, then convert the word to search to - // all uppercase (for case-insensitive searching) and the substitution - // word to all lowercase (to make sure it looks good). + // all uppercase for case-insensitive searching. wordToSearch = trimSpaces(fileLine.substr(0, equalsPos), true, false, true); - substWord = trimSpaces(fileLine.substr(equalsPos+1), true, false, true); + substWord = strip_ctrl(trimSpaces(fileLine.substr(equalsPos+1), true, false, true)); // Make sure substWord only contains printable characters. If not, then // skip this one. var substIsPrintable = true; @@ -2344,7 +2353,6 @@ function populateTxtReplacements(pArray, pRegex) else { wordToSearch = wordToSearch.toUpperCase(); - substWord = substWord.toLowerCase(); if (wordToSearch != substWord.toUpperCase()) { pArray[wordToSearch] = substWord; @@ -2570,7 +2578,7 @@ function doMacroTxtReplacementInEditLine(pTxtReplacements, pEditLinesIndex, pCha wordObj.word = wordObj.word.toUpperCase(); if (pTxtReplacements.hasOwnProperty(wordObj.word)) { - txtReplacement = pTxtReplacements[wordObj.word].toLowerCase(); + txtReplacement = pTxtReplacements[wordObj.word]; retObj.madeTxtReplacement = true; } } -- GitLab