4 enum FindInFilesMode { directory, workspace, project };
6 class FindInFilesDialog : Window
8 text = $"Find In Files";
9 background = formColor;
10 borderStyle = sizable;
11 minClientSize = { 440, 208 };
12 maxClientSize = { 640, 208 };
19 property char * searchString { set { findContent.contents = value; } get { return findContent.contents; } };
20 property bool contentWholeWord { set { contentWholeWord.checked = value; } get { return contentWholeWord.checked; } };
21 property bool contentMatchCase { set { contentMatchCase.checked = value; } get { return contentMatchCase.checked; } };
22 property char * currentDirectory
26 GetWorkingDir(currentDirectory, MAX_DIRECTORY);
27 PathCat(currentDirectory, value);
28 FileFixCase(currentDirectory);
29 findWhere.path = currentDirectory;
31 get { return (char *)currentDirectory; }
33 property FileFilter * filters { set { filters = value; } get { return filters; } };
34 // Replace with Array system
35 property int sizeFilters
39 int numFilters = value / sizeof(FileFilter);
44 // File Extension Filter
46 // filterDrop.AddField(null);
50 for(c = 0; c<numFilters; c++)
52 DataRow row = filterDrop.AddString(filters[c].name);
53 if(filters[c].extensions && !strcmp(filters[c].extensions, "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx"))
59 filterDrop.AddString($"All files");
61 //if(fileFilter >= numFilters)
63 filterDrop.currentRow = filterDrop.FindRow(fileFilter);
65 get { return sizeFilters; }
67 property int filter { set { fileFilter = value; } get { return fileFilter; } };
69 property FindInFilesMode mode
76 findIn.SelectRow(inDirectoryRow);
79 findIn.SelectRow(inWorkspaceRow);
84 for(row = findIn.firstRow; row; row = row.next)
85 if(row != inDirectoryRow && row != inWorkspaceRow)
88 findIn.SelectRow(row);
92 lastSelectionMode = value;
96 if(findIn.currentRow == inDirectoryRow)
98 else if(findIn.currentRow == inWorkspaceRow)
105 property char * findDir
107 get { return searchThread.mode == directory ? (char *)searchThread.dir : null; }
109 /*if(searchThread.mode == directory)
110 ide.outputView.findDir = CopyString(searchThread.dir);
111 else if(searchThread.mode == project)
112 ide.outputView.findProject = searchThread.project;*/
113 property Project findProject
115 get { return searchThread.mode == project ? searchThread.project : null; }
118 property bool replaceMode
122 if(value != replaceMode)
124 int h = value ? 236 : 208;
125 find.text = value ? $"Replace" : $"Find";
126 find.hotKey = value ? altF : altR; // tocheck: the hotkey keeps getting lost
127 llreplaceWith.visible = value;
128 text = value ? $"Replace In Files" : $"Find In Files";
137 void AddProjectItem(Project project)
141 char label[MAX_FILENAME];
143 sprintf(label, $"%s Project", project.name);
144 row = findIn.AddString(label);
145 row.tag = (int64)project;
149 void RemoveProjectItem(Project project)
154 for(row = inWorkspaceRow.next; row; row = row.next)
156 if((Project)row.tag == project)
158 findIn.DeleteRow(row);
175 char currentDirectory[MAX_DIRECTORY];
176 FileFilter * filters;
179 DataRow inDirectoryRow;
180 DataRow inWorkspaceRow;
181 FindInFilesMode lastSelectionMode;
182 String lastSelectionProject;
183 String lastSelectionProjectNode;
185 SelectorButton starDir;
189 GetWorkingDir(currentDirectory, MAX_DIRECTORY);
190 FileFixCase(currentDirectory);
191 findWhere.path = currentDirectory;
192 findWherePrjNode.AddField(projectNodeField);
202 this, anchor = { left = 20, top = 4, right = 8, bottom = 0 };
203 direction = horizontal;
214 anchor.top = 0, anchor.bottom = 0;
218 LayoutLine llfindIn { lpmain, this, size.h = 26 };
219 LayoutLine llfindWhere { lpmain, this, size.h = 26 };
220 LayoutLine llsubDirs { lpmain, this, size.h = 18 };
221 LayoutLine llfilter { lpmain, this, size.h = 26 };
222 LayoutLine llfileName { lpmain, this, size.h = 26 };
223 LayoutLine llfindWhat { lpmain, this, size.h = 26 };
224 LayoutLine llwholeWord { lpmain, this, size.h = 18 };
225 LayoutLine llmatchCase { lpmain, this, size.h = 18 };
226 LayoutLine llreplaceWith { lpmain, this, size.h = 26, visible = false };
228 Label lfindIn { llfindIn, this, size.w = 72, labeledWindow = findIn };
231 llfindIn, this, $"Find in:", altI, anchor.right = 0;
233 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
235 FindInFilesMode mode = this.mode;
236 bool inDir = mode == directory;
237 bool inWrk = mode == workspace;
238 bool inPrj = mode == project;
240 lfindWhere.labeledWindow = findWherePrjNode;
242 lfindWhere.labeledWindow = findWhere;
243 findWhere.visible = !inPrj;
244 findWhere.disabled = !inDir;
245 findWherePrjNode.visible = inPrj;
246 subDirs.disabled = inWrk;
247 llfindWhere.size = { llfindWhere.size.w, llfindWhere.size.h };
252 lastSelectionMode = mode;
253 prj = lastSelectionMode == project ? (Project)row.tag : null;
254 delete lastSelectionProject;
258 ProjectNode node = prj.topNode;
259 char filePath[MAX_LOCATION];
260 prj.topNode.GetFullFilePath(filePath);
261 lastSelectionProject = CopyString(filePath);
262 findWherePrjNode.Clear();
263 ListProjectNodeFolders(node, null);
265 if(lastSelectionProjectNode && !(node = prj.topNode.FindByFullPath(lastSelectionProjectNode, false)))
268 delete lastSelectionProjectNode;
271 for(r = findWherePrjNode.firstRow; r; r = r.next)
272 if((ProjectNode)r.tag == node)
275 findWherePrjNode.SelectRow(r);
282 void ListProjectNodeFolders(ProjectNode node, DataRow parentRow)
286 row = findWherePrjNode/*parentRow*/.AddRow();
288 row = findWherePrjNode.AddRow();
289 row.tag = (int64)node;
290 row.SetData(null, node);
293 for(child : node.files; child.type == folder/* || child.type == file*//* || child.type == folderOpen*/)
294 ListProjectNodeFolders(child, row);
298 Label lfindWhere { llfindWhere, this, size.w = 72, labeledWindow = findWhere };
301 llfindWhere, this, $"Find where:", altH, size.h = 24, anchor.right = 0;
302 typeExpected = directory, browseDialog = fileDialog;
304 DropBox findWherePrjNode
306 llfindWhere, this, $"Find where:", altH, size.h = 24, anchor.right = 0;
308 //collapseControl = true, treeBranches = true;
310 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
314 ProjectNode node = (ProjectNode)row.tag;
315 delete lastSelectionProjectNode;
318 char filePath[MAX_LOCATION];
319 node.GetFullFilePath(filePath);
320 lastSelectionProjectNode = CopyString(filePath);
326 DataField projectNodeField { dataType = "ProjectNode", freeData = false };
328 Window spacerA { llsubDirs, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
331 llsubDirs, this, $"Include Subdirectories", altU, isCheckbox = true, checked = true;
334 Label lfilter { llfilter, this, size.w = 72, labeledWindow = filterDrop };
337 llfilter, this, $"Filter:", altL, anchor.right = 0;
339 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
341 fileFilter = (int)(row ? row.tag : 0);
347 Label lfileName { llfileName, this, size.w = 72, labeledWindow = fileName };
350 llfileName, this, $"File name:", altN, size.h = 24, anchor.right = 0;
353 //Window spacerX { ll, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
354 //Button nameWholeWord { ll, this, "Whole word only", AltO, isCheckbox = true };
355 //Window spacerX { llwholeWord, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
356 //Button nameMatchCase { ll, this, "Match case", altA, isCheckbox = true };
358 Label lfindContent { llfindWhat, this, size.w = 72, labeledWindow = findContent };
361 llfindWhat, this, $"Find what:", altT, size.h = 24, anchor.right = 0;
364 Label lreplaceWith { llreplaceWith, this, size.w = 72, labeledWindow = replaceWith };
367 llreplaceWith, this, $"Replace with:", altE;
368 size.h = 24, anchor.right = 0;
371 Window spacerB { llwholeWord, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
372 Button contentWholeWord { llwholeWord, this, $"Whole word only", altW, isCheckbox = true };
374 Window spacerC { llmatchCase, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
375 Button contentMatchCase { llmatchCase, this, $"Match case", altC, isCheckbox = true };
382 anchor.top = 0, anchor.bottom = 0;
386 LayoutLine llspace { lpbuttons, this, size.h = 2 };
387 LayoutLine llfind { lpbuttons, this, size.h = 30 };
388 LayoutLine llcancel { lpbuttons, this, size.h = 30 };
392 llfind, this, $"Find", altF, isDefault = true, size = { 80, 24 }, anchor.horz = 0, anchor.vert = 0, keyRepeat = true;
394 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
396 String findPath = findWhere.path;
397 if(findIn.currentRow == inDirectoryRow && !findPath[0])
399 findWhere.Activate();
400 MessageBox { type = ok, master = parent,
401 text = text, contents = $"You must specify a search location." }.Modal();
403 else if(findIn.currentRow == inDirectoryRow && !FileExists(findPath))
405 findWhere.Activate();
406 MessageBox { type = ok, master = parent,
407 text = text, contents = $"Search location does not exist. Please provide a valid location." }.Modal();
409 else if(!fileName.contents[0] && !findContent.contents[0])
411 findContent.Activate();
412 MessageBox { type = ok, master = parent,
413 text = text, contents = $"Nothing to be found. Please specify at least one criteria." }.Modal();
417 findContent.Activate();
427 llcancel, this, $"Cancel", hotKey = { escape }, size = { 80, 24 }, anchor.horz = 0, anchor.vert = 0;
429 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
431 findContent.Activate();
437 SearchThread searchThread { findDialog = this };
438 FileDialog fileDialog { master = this, type = selectDir, text = $"Select Search Location..." };
443 inDirectoryRow = null;
444 inWorkspaceRow = null;
450 bool withWorkspace = (bool)ide.workspace;
453 inDirectoryRow = findIn.AddString($"Directory");
457 inWorkspaceRow = findIn.AddString($"Workspace");
458 for(prj : ide.workspace.projects)
460 if(lastSelectionProject)
462 for(row = findIn.firstRow; row; row = row.next)
464 char filePath[MAX_LOCATION];
465 Project p = (Project)row.tag;
468 p.topNode.GetFullFilePath(filePath);
469 if(!fstrcmp(filePath, lastSelectionProject))
474 findIn.SelectRow(row);
476 delete lastSelectionProject;
478 if(!lastSelectionProject)
480 if(lastSelectionMode == project)
482 Project prj = ide.workspace.projects.firstIterator.data;
483 for(row = findIn.firstRow; row; row = row.next)
484 if((Project)row.tag == prj)
487 findIn.SelectRow(row);
490 property::mode = lastSelectionMode;
495 findIn.SelectRow(inDirectoryRow);
498 findIn.disabled = !withWorkspace;
499 /*disabled = findIn.currentRow != inDirectoryRow;
501 findWhere.disabled = disabled;
502 subDirs.disabled = disabled;*/
504 findContent.Activate();
512 searchThread.active = true;
513 searchThread.project = null;
514 searchThread.projectNode = null;
515 searchThread.subDirs = subDirs.checked;
517 if(findIn.currentRow == inDirectoryRow)
519 searchThread.mode = directory;
520 strcpy(searchThread.dir, findWhere.slashPath);
522 else if(findIn.currentRow == inWorkspaceRow)
524 searchThread.mode = workspace;
525 searchThread.subDirs = true;
529 searchThread.mode = project;
530 searchThread.project = (Project)findIn.currentRow.tag;
531 searchThread.projectNode = (ProjectNode)(findWherePrjNode.currentRow ? findWherePrjNode.currentRow.tag : null);
533 //searchThread.nameMatchCase = nameMatchCase.checked;
534 //searchThread.nameWholeWord = nameWholeWord.checked;
535 searchThread.contentMatchCase = contentMatchCase.checked;
536 searchThread.contentWholeWord = contentWholeWord.checked;
538 searchThread.filter = filters[fileFilter];
540 strcpy(searchThread.nameCriteria, fileName.contents);
541 strcpy(searchThread.contentCriteria, findContent.contents);
543 strcpy(searchThread.contentReplace, replaceWith.contents);
544 searchThread.replaceMode = replaceMode;
546 //cancel.text = "Stop";
548 ide.outputView.ShowClearSelectTab(find);
552 searchThread.Create();
557 if(searchThread.active)
559 searchThread.Abort();
567 if(searchThread.active)
569 searchThread.Abort();
570 searchThread.Abort();
579 void SearchComplete()
581 //cancel.text = $"Cancel";
589 bool NotifyCharsAddedDeletedNameContent(EditBox editBox, BufferLocation before, BufferLocation after, bool pasteOperation)
591 find.disabled = (strlen(fileName.contents) == 0 && strlen(findContent.contents) == 0);
595 bool OnKeyHit(Key key, unichar ch)
597 if(ch && !key.alt && !key.ctrl && !key.shift && (contentMatchCase.active || contentWholeWord.active))
599 findContent.Activate();
600 return findContent.OnKeyHit(key, ch);
606 class SearchThread : Thread
609 bool active, subDirs/*, nameMatchCase, nameWholeWord*/, contentMatchCase, contentWholeWord;
610 char dir[MAX_DIRECTORY], contentCriteria[1024], contentReplace[1024], nameCriteria[1024];
612 FindInFilesDialog findDialog;
613 FindInFilesMode mode;
615 ProjectNode projectNode;
628 bool abort, abortNow;
637 int HowManyDigits(int num)
650 int frame, treeTop = 0;
651 int globalFindCount = 0, filesSearchedCount = 0, filesMatchedCount = 0, dirsMatchedCount = 0;
652 //double lastTime = GetTime();
653 SearchStackFrame stack[1024];
654 FindInFilesMode mode = this.mode;
656 EditBox replaceEdit = null;
664 char containing[512];
667 if(!strcmp(filter.name, "All files"))
668 filterName = "files";
670 filterName = filter.name;
672 sprintf(substring, $" with file name matching \"%s\"", nameCriteria);
675 if(contentCriteria && contentCriteria[0])
676 sprintf(containing, $" containing \"%s\"", contentCriteria);
678 containing[0] = '\0';
679 if(substring[0] && containing[0])
683 if(mode == directory)
686 ide.outputView.findBox.Logf(
687 $"Searching \"%s\"%s for %s%s%s%s\n\n",
688 (s = CopySystemPath(dir)), subDirs ? $" and its sub directories" : "",
689 filterName, substring, and, containing);
692 else if(mode == workspace)
693 ide.outputView.findBox.Logf(
694 $"Searching workspace files for %s%s%s%s\n\n",
695 filterName, substring, and, containing);
696 else if(mode == project)
697 ide.outputView.findBox.Logf(
698 $"Searching project %s files for %s%s%s%s\n\n",
699 project.name, filterName, substring, and, containing);
705 replaceEdit = EditBox
707 multiLine = true,textHorzScroll = true,textVertScroll = true,
708 text = $"Replacing Editbox", size = Size { 640,480 }/*,maxLineSize = 65536*/
712 if(mode == directory)
714 strcpy(stack[0].path, dir);
715 stack[0].fileList = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
717 for(frame = 0; frame >= 0 && !abort; )
719 if(stack[frame].fileList.Find())
724 char name[MAX_LOCATION];
725 GetLastDirectory(stack[frame].fileList.path, name);
726 if(!(bool)SearchString(name, 0, nameCriteria, false, false))
729 if(!stack[frame].fileList.stats.attribs.isDirectory)
731 bool relative = false;
732 char fileRelative[MAX_LOCATION];
733 if(filter.ValidateFileName(stack[frame].fileList.name))
735 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
738 filesSearchedCount++;
739 if(match && contentCriteria[0])
744 ide.outputView.findBox.Tellf(
745 $"Searching %s for %s", relative ? fileRelative : stack[frame].fileList.path, contentCriteria);
749 ret = SearchFileContentAndReplace(stack[frame].fileList.path, relative, fileRelative, replaceEdit);
751 ret = SearchFileContent(stack[frame].fileList.path, relative, fileRelative);
754 globalFindCount += ret;
758 else if(match && nameCriteria[0])
762 ide.outputView.findBox.Logf(
764 relative ? fileRelative : stack[frame].fileList.path);
771 bool relative = false;
772 char fileRelative[MAX_LOCATION];
773 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
776 if(match && nameCriteria[0])
779 ide.outputView.findBox.Logf(
781 relative ? fileRelative : stack[frame].fileList.path);
783 ide.outputView.findBox.Tellf(
784 $"Searching %s", relative ? fileRelative : stack[frame].fileList.path);
788 if(subDirs && stack[frame].fileList.stats.attribs.isDirectory && strcmp(stack[frame].fileList.name, ".git"))
790 int lastFrame = frame;
791 /*double thisTime = GetTime();
793 if(thisTime - lastTime > 0.25)
795 findDialog.SearchUpdateLabel(stack[lastFrame].fileList.path);
800 strcpy(stack[frame].path, stack[lastFrame].fileList.path);
801 stack[frame].fileList = FileListing { stack[frame].path, extensions = stack[lastFrame].fileList.extensions };
810 for( ; frame >= 0 ; frame--)
811 stack[frame].fileList.Stop();
813 else if(mode == workspace || mode == project)
816 char path[MAX_LOCATION];
817 bool firtIteration = true;
818 Project prj = project;
819 ProjectNode stack[1024];
820 Iterator<Project> it { ide.workspace.projects };
824 if(mode == workspace)
826 if(!it.Next()) break;
829 stack[1] = projectNode ? projectNode : prj.topNode;
831 for(frame = 1; frame && !abort;)
833 switch(stack[frame].type)
836 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
838 int lastFrame = frame;
840 stack[frame] = stack[lastFrame].files.first;
841 firtIteration = false;
846 bool relative = true;
847 char fileRelative[MAX_LOCATION];
848 char filePath[MAX_LOCATION];
850 PathCat(filePath, prj.topNode.path);
851 PathCat(filePath, stack[frame].path);
852 PathCat(filePath, stack[frame].name);
853 fileRelative[0] = '\0';
854 PathCat(fileRelative, stack[frame].path);
855 PathCat(fileRelative, stack[frame].name);
856 if(relative && mode == workspace && prj != ide.project)
858 char special[MAX_LOCATION];
859 sprintf(special, "(%s)%s", prj.name, fileRelative);
860 strcpy(fileRelative, special);
862 if(filter.ValidateFileName(stack[frame].name))
864 filesSearchedCount++;
865 if(!nameCriteria[0] || (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
867 if(contentCriteria[0])
872 ide.outputView.findBox.Tellf(
873 $"Searching %s for \"%s\"", relative ? fileRelative : filePath,
878 ret = SearchFileContentAndReplace(filePath, relative, fileRelative, replaceEdit);
880 ret = SearchFileContent(filePath, relative, fileRelative);
883 globalFindCount += ret;
887 else if(nameCriteria[0])
891 ide.outputView.findBox.Logf(
892 "%s\n", relative ? fileRelative : filePath);
897 stack[frame] = stack[frame].next;
902 bool relative = true;
903 char fileRelative[MAX_LOCATION];
904 char filePath[MAX_LOCATION];
906 PathCat(filePath, prj.topNode.path);
907 PathCat(filePath, stack[frame].path);
908 fileRelative[0] = '\0';
909 PathCat(fileRelative, stack[frame].path);
910 if(relative && mode == workspace && prj != ide.project)
912 char special[MAX_LOCATION];
913 sprintf(special, "(%s)%s", prj.name, fileRelative);
914 strcpy(fileRelative, special);
916 if(nameCriteria[0] && (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
920 ide.outputView.findBox.Logf(
921 "%s\n", relative ? fileRelative : filePath);
924 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
926 int lastFrame = frame;
928 stack[frame] = stack[lastFrame].files.first;
929 firtIteration = false;
932 stack[frame] = stack[frame].next;
936 stack[frame] = stack[frame].next;
939 while(frame && !stack[frame])
942 if(frame == 1 && projectNode && stack[frame] == projectNode)
945 stack[frame] = stack[frame].next;
948 if(mode == project) break;
952 for( ; frame ; frame--)
961 if(filesSearchedCount)
963 if(!contentCriteria[0] && (filesMatchedCount || dirsMatchedCount))
964 ide.outputView.findBox.Logf("\n");
966 ide.outputView.findBox.Logf(
967 $"%s search %s a total of %d match%s in %d out of the %d file%s searched\n",
968 abort ? $"Aborted" : $"Completed", replaceMode ? $"replaced" : $"found", globalFindCount, (globalFindCount > 1) ? $"es" : "",
969 filesMatchedCount, filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
970 else if(filesMatchedCount)
971 ide.outputView.findBox.Logf(
972 $"%s search found a total of %d match%s in the %d file%s searched\n",
973 abort ? $"Aborted" : $"Completed", filesMatchedCount, (filesMatchedCount > 1) ? $"es" : "",
974 filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
976 ide.outputView.findBox.Logf(
977 $"%s search did not find any match in the %d files searched\n",
978 abort ? $"Aborted" : $"Completed", filesSearchedCount);
981 ide.outputView.findBox.Logf(
982 $"%s search did not find any file\n", abort ? $"Aborted" : $"Completed");
983 findDialog.SearchComplete();
988 int SearchFileContent(char *filePath, bool relative, char *fileRelative)
991 File f = FileOpen(filePath, read);
997 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
1002 int inLineFindCount = 0;
1004 while((find = SearchString(line, start, contentCriteria, contentMatchCase, contentWholeWord)) && !abortNow)
1007 col = find - &line[start] + 1;
1008 start += (find - &line[start]) / sizeof(char) + strlen(contentCriteria);
1011 if(inLineFindCount && !abortNow)
1015 int len = strlen(line);
1016 s1[6 - HowManyDigits(lineNum)] = '\0';
1017 s2[4 - HowManyDigits(col)] = '\0';
1018 // Cut the line longer than 1024 because Logf prints to a buffer (and we don't want to output crazy long lines either)
1027 ide.outputView.findBox.Logf(
1028 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1029 lineNum, col, s1, s2, line);
1031 findCount += inLineFindCount;
1035 f.Seek(-strlen(contentCriteria), current);*/
1041 ide.outputView.findBox.Logf(
1042 $"Found %d match%s in \"%s\"%s\n\n", findCount, (findCount > 1) ? "es" : "",
1043 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1050 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1056 int SearchFileContentAndReplace(char *filePath, bool relative, char *fileRelative, EditBox edit)
1058 int replaceCount = -1;
1059 File f = FileOpen(filePath, read);
1064 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
1068 int inLineFindCount = 0;
1069 if(SearchString(line, 0, contentCriteria, contentMatchCase, contentWholeWord) && !abortNow)
1071 int lastLineNum = 0;
1076 for(; edit.Find(contentCriteria, contentWholeWord, contentMatchCase, true) == found; replaceCount++)
1078 int lineNum = edit.lineNumber + 1;
1079 edit.PutS(contentReplace);
1080 if(lineNum != lastLineNum)
1086 //int len = strlen(line);
1087 s1[6 - HowManyDigits(lineNum)] = '\0';
1088 s2[4 - HowManyDigits(col)] = '\0';
1089 strncpy(line, edit.line.text, 1023);
1092 // Cut the line longer than 1024 because Logf prints
1093 // to a buffer (and we don't want to output crazy long lines either)
1101 ide.outputView.findBox.Logf(
1102 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1103 lineNum, col, s1, s2, line);
1109 if((f = FileOpen(filePath, write)))
1111 edit.Save(f, false);
1120 f.Seek(-strlen(contentCriteria), current);*/
1127 ide.outputView.findBox.Logf(
1128 $"Replaced %d match%s in \"%s\"%s\n\n", replaceCount, (replaceCount > 1) ? $"es" : "",
1129 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1136 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1139 return replaceCount;
1143 static struct SearchStackFrame
1146 char path[MAX_LOCATION];
1147 FileListing fileList;