mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Make searches case insensitive by default
This is to match finding in files and is typically the default. Need to extend this logic to find in all documents and also filenames. Also add case insensitive switch to find/replace control.
This commit is contained in:
@@ -782,27 +782,27 @@ var ICEcoder = {
|
||||
var find, replace, results, cM, content, lineCount, numChars, charsToCursor, charCount, cursor, replaceQS, targetQS;
|
||||
|
||||
// Determine our find & replace strings and the length of them
|
||||
find = top.document.getElementById('find').value;
|
||||
replace = top.document.getElementById('replace').value;
|
||||
find = top.document.getElementById('find').value.toLowerCase();
|
||||
replace = top.document.getElementById('replace').value.toLowerCase();
|
||||
results = top.document.getElementById('results');
|
||||
|
||||
// If we have something to find in currrent document
|
||||
if (find.length>0 && document.findAndReplace.target.value=="this document") {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
content = cM.getValue().toLowerCase();
|
||||
|
||||
// Find & replace the next instance, or all?
|
||||
if (document.findAndReplace.connector.value=="and") {
|
||||
if (document.findAndReplace.replaceAction.value=="replace" && cM.getSelection()==find) {
|
||||
if (document.findAndReplace.replaceAction.value=="replace" && cM.getSelection().toLowerCase()==find) {
|
||||
cM.replaceSelection(replace);
|
||||
} else if (document.findAndReplace.replaceAction.value=="replace all" && buttonClick) {
|
||||
var rExp = new RegExp(find,"g");
|
||||
var rExp = new RegExp(find,"gi");
|
||||
cM.setValue(cM.getValue().replace(rExp,replace));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the content again, as it might of changed
|
||||
content = cM.getValue();
|
||||
content = cM.getValue().toLowerCase();
|
||||
if (!top.ICEcoder.findMode||find!=top.ICEcoder.lastsearch) {
|
||||
ICEcoder.results = [];
|
||||
|
||||
@@ -858,10 +858,10 @@ var ICEcoder = {
|
||||
charCount++;
|
||||
}
|
||||
|
||||
cursor = cM.getSearchCursor(find,cM.getCursor());
|
||||
cursor = cM.getSearchCursor(find,cM.getCursor(),true);
|
||||
cursor.findNext();
|
||||
if (!cursor.from()) {
|
||||
cursor = cM.getSearchCursor(find,{line:0,ch:0});
|
||||
cursor = cM.getSearchCursor(find,{line:0,ch:0},true);
|
||||
cursor.findNext();
|
||||
}
|
||||
// Finally, highlight our selection
|
||||
|
||||
Reference in New Issue
Block a user