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)
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;
665 sprintf(substring, $" with file name matching \"%s\"", nameCriteria);
668 if(mode == directory)
671 ide.outputView.findBox.Logf(
672 $"Searching \"%s\"%s for %s%s%s containing \"%s\"\n\n",
673 (s = CopySystemPath(dir)), subDirs ? $" and its sub directories" : "",
674 filter.name, substring, substring[0] ? $" and" : "", contentCriteria);
677 else if(mode == workspace)
678 ide.outputView.findBox.Logf(
679 $"Searching workspace files for files%s%s containing \"%s\"\n\n",
680 substring, substring[0] ? $" and" : "", contentCriteria);
681 else if(mode == project)
682 ide.outputView.findBox.Logf(
683 $"Searching project %s files for files%s%s containing \"%s\"\n\n",
684 project.name, substring, substring[0] ? $" and" : "", contentCriteria);
690 replaceEdit = EditBox
692 multiLine = true,textHorzScroll = true,textVertScroll = true,
693 text = $"Replacing Editbox", size = Size { 640,480 }/*,maxLineSize = 65536*/
697 if(mode == directory)
699 strcpy(stack[0].path, dir);
700 stack[0].fileList = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
702 for(frame = 0; frame >= 0 && !abort; )
704 if(stack[frame].fileList.Find())
709 char name[MAX_LOCATION];
710 GetLastDirectory(stack[frame].fileList.path, name);
711 if(!(bool)SearchString(name, 0, nameCriteria, false, false))
714 if(!stack[frame].fileList.stats.attribs.isDirectory)
716 bool relative = false;
717 char fileRelative[MAX_LOCATION];
718 if(filter.ValidateFileName(stack[frame].fileList.name))
720 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
723 filesSearchedCount++;
724 if(match && contentCriteria[0])
729 ide.outputView.findBox.Tellf(
730 $"Searching %s for %s", relative ? fileRelative : stack[frame].fileList.path, contentCriteria);
734 ret = SearchFileContentAndReplace(stack[frame].fileList.path, relative, fileRelative, replaceEdit);
736 ret = SearchFileContent(stack[frame].fileList.path, relative, fileRelative);
739 globalFindCount += ret;
743 else if(match && nameCriteria[0])
747 ide.outputView.findBox.Logf(
749 relative ? fileRelative : stack[frame].fileList.path);
756 bool relative = false;
757 char fileRelative[MAX_LOCATION];
758 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
761 if(match && nameCriteria[0])
764 ide.outputView.findBox.Logf(
766 relative ? fileRelative : stack[frame].fileList.path);
768 ide.outputView.findBox.Tellf(
769 $"Searching %s", relative ? fileRelative : stack[frame].fileList.path);
773 if(subDirs && stack[frame].fileList.stats.attribs.isDirectory && strcmp(stack[frame].fileList.name, ".git"))
775 int lastFrame = frame;
776 /*double thisTime = GetTime();
778 if(thisTime - lastTime > 0.25)
780 findDialog.SearchUpdateLabel(stack[lastFrame].fileList.path);
785 strcpy(stack[frame].path, stack[lastFrame].fileList.path);
786 stack[frame].fileList = FileListing { stack[frame].path, extensions = stack[lastFrame].fileList.extensions };
795 for( ; frame >= 0 ; frame--)
796 stack[frame].fileList.Stop();
798 else if(mode == workspace || mode == project)
801 char path[MAX_LOCATION];
802 bool firtIteration = true;
803 Project prj = project;
804 ProjectNode stack[1024];
805 Iterator<Project> it { ide.workspace.projects };
809 if(mode == workspace)
811 if(!it.Next()) break;
814 stack[1] = projectNode ? projectNode : prj.topNode;
816 for(frame = 1; frame && !abort;)
818 switch(stack[frame].type)
821 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
823 int lastFrame = frame;
825 stack[frame] = stack[lastFrame].files.first;
826 firtIteration = false;
831 bool relative = true;
832 char fileRelative[MAX_LOCATION];
833 char filePath[MAX_LOCATION];
835 PathCat(filePath, prj.topNode.path);
836 PathCat(filePath, stack[frame].path);
837 PathCat(filePath, stack[frame].name);
838 fileRelative[0] = '\0';
839 PathCat(fileRelative, stack[frame].path);
840 PathCat(fileRelative, stack[frame].name);
841 if(relative && mode == workspace && prj != ide.project)
843 char special[MAX_LOCATION];
844 sprintf(special, "(%s)%s", prj.name, fileRelative);
845 strcpy(fileRelative, special);
847 if(filter.ValidateFileName(stack[frame].name))
849 filesSearchedCount++;
850 if(!nameCriteria[0] || (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
852 if(contentCriteria[0])
857 ide.outputView.findBox.Tellf(
858 $"Searching %s for \"%s\"", relative ? fileRelative : filePath,
863 ret = SearchFileContentAndReplace(filePath, relative, fileRelative, replaceEdit);
865 ret = SearchFileContent(filePath, relative, fileRelative);
868 globalFindCount += ret;
872 else if(nameCriteria[0])
876 ide.outputView.findBox.Logf(
877 "%s\n", relative ? fileRelative : filePath);
882 stack[frame] = stack[frame].next;
887 bool relative = true;
888 char fileRelative[MAX_LOCATION];
889 char filePath[MAX_LOCATION];
891 PathCat(filePath, prj.topNode.path);
892 PathCat(filePath, stack[frame].path);
893 fileRelative[0] = '\0';
894 PathCat(fileRelative, stack[frame].path);
895 if(relative && mode == workspace && prj != ide.project)
897 char special[MAX_LOCATION];
898 sprintf(special, "(%s)%s", prj.name, fileRelative);
899 strcpy(fileRelative, special);
901 if(nameCriteria[0] && (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
905 ide.outputView.findBox.Logf(
906 "%s\n", relative ? fileRelative : filePath);
909 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
911 int lastFrame = frame;
913 stack[frame] = stack[lastFrame].files.first;
914 firtIteration = false;
917 stack[frame] = stack[frame].next;
921 stack[frame] = stack[frame].next;
924 while(frame && !stack[frame])
927 if(frame == 1 && projectNode && stack[frame] == projectNode)
930 stack[frame] = stack[frame].next;
933 if(mode == project) break;
937 for( ; frame ; frame--)
946 if(filesSearchedCount)
948 if(!contentCriteria[0] && (filesMatchedCount || dirsMatchedCount))
949 ide.outputView.findBox.Logf("\n");
951 ide.outputView.findBox.Logf(
952 $"%s search %s a total of %d match%s in %d out of the %d file%s searched\n",
953 abort ? $"Aborted" : $"Completed", replaceMode ? $"replaced" : $"found", globalFindCount, (globalFindCount > 1) ? $"es" : "",
954 filesMatchedCount, filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
955 else if(filesMatchedCount)
956 ide.outputView.findBox.Logf(
957 $"%s search found a total of %d match%s in the %d file%s searched\n",
958 abort ? $"Aborted" : $"Completed", filesMatchedCount, (filesMatchedCount > 1) ? $"es" : "",
959 filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
961 ide.outputView.findBox.Logf(
962 $"%s search did not find any match in the %d files searched\n",
963 abort ? $"Aborted" : $"Completed", filesSearchedCount);
966 ide.outputView.findBox.Logf(
967 $"%s search did not find any file\n", abort ? $"Aborted" : $"Completed");
968 findDialog.SearchComplete();
973 int SearchFileContent(char *filePath, bool relative, char *fileRelative)
976 File f = FileOpen(filePath, read);
982 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
987 int inLineFindCount = 0;
989 while((find = SearchString(line, start, contentCriteria, contentMatchCase, contentWholeWord)) && !abortNow)
992 col = find - &line[start] + 1;
993 start += (find - &line[start]) / sizeof(char) + strlen(contentCriteria);
996 if(inLineFindCount && !abortNow)
1000 int len = strlen(line);
1001 s1[6 - HowManyDigits(lineNum)] = '\0';
1002 s2[4 - HowManyDigits(col)] = '\0';
1003 // Cut the line longer than 1024 because Logf prints to a buffer (and we don't want to output crazy long lines either)
1012 ide.outputView.findBox.Logf(
1013 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1014 lineNum, col, s1, s2, line);
1016 findCount += inLineFindCount;
1020 f.Seek(-strlen(contentCriteria), current);*/
1026 ide.outputView.findBox.Logf(
1027 $"Found %d match%s in \"%s\"%s\n\n", findCount, (findCount > 1) ? "es" : "",
1028 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1035 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1041 int SearchFileContentAndReplace(char *filePath, bool relative, char *fileRelative, EditBox edit)
1043 int replaceCount = -1;
1044 File f = FileOpen(filePath, read);
1049 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
1053 int inLineFindCount = 0;
1054 if(SearchString(line, 0, contentCriteria, contentMatchCase, contentWholeWord) && !abortNow)
1056 int lastLineNum = 0;
1061 for(; edit.Find(contentCriteria, contentWholeWord, contentMatchCase, true) == found; replaceCount++)
1063 int lineNum = edit.lineNumber + 1;
1064 edit.PutS(contentReplace);
1065 if(lineNum != lastLineNum)
1071 //int len = strlen(line);
1072 s1[6 - HowManyDigits(lineNum)] = '\0';
1073 s2[4 - HowManyDigits(col)] = '\0';
1074 strncpy(line, edit.line.text, 1023);
1077 // Cut the line longer than 1024 because Logf prints
1078 // to a buffer (and we don't want to output crazy long lines either)
1086 ide.outputView.findBox.Logf(
1087 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1088 lineNum, col, s1, s2, line);
1094 if((f = FileOpen(filePath, write)))
1096 edit.Save(f, false);
1105 f.Seek(-strlen(contentCriteria), current);*/
1112 ide.outputView.findBox.Logf(
1113 $"Replaced %d match%s in \"%s\"%s\n\n", replaceCount, (replaceCount > 1) ? $"es" : "",
1114 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1121 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1124 return replaceCount;
1128 static struct SearchStackFrame
1131 char path[MAX_LOCATION];
1132 FileListing fileList;