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 };
20 property char * searchString { set { findContent.contents = value; } get { return findContent.contents; } };
21 property bool contentWholeWord { set { contentWholeWord.checked = value; } get { return contentWholeWord.checked; } };
22 property bool contentMatchCase { set { contentMatchCase.checked = value; } get { return contentMatchCase.checked; } };
23 property char * currentDirectory
27 GetWorkingDir(currentDirectory, MAX_DIRECTORY);
28 PathCat(currentDirectory, value);
29 FileFixCase(currentDirectory);
30 findWhere.path = currentDirectory;
32 get { return (char *)currentDirectory; }
34 property FileFilter * filters { set { filters = value; } get { return filters; } };
35 // Replace with Array system
36 property int sizeFilters
40 int numFilters = value / sizeof(FileFilter);
45 // File Extension Filter
47 // filterDrop.AddField(null);
51 for(c = 0; c<numFilters; c++)
53 DataRow row = filterDrop.AddString(filters[c].name);
54 if(filters[c].extensions && !strcmp(filters[c].extensions, "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx"))
60 filterDrop.AddString($"All files");
62 //if(fileFilter >= numFilters)
64 filterDrop.currentRow = filterDrop.FindRow(fileFilter);
66 get { return sizeFilters; }
68 property int filter { set { fileFilter = value; } get { return fileFilter; } };
70 property FindInFilesMode mode
77 findIn.SelectRow(inDirectoryRow);
80 findIn.SelectRow(inWorkspaceRow);
85 for(row = findIn.firstRow; row; row = row.next)
86 if(row != inDirectoryRow && row != inWorkspaceRow)
89 findIn.SelectRow(row);
93 lastSelectionMode = value;
97 if(findIn.currentRow == inDirectoryRow)
99 else if(findIn.currentRow == inWorkspaceRow)
106 property char * findDir
108 get { return searchThread.mode == directory ? (char *)searchThread.dir : null; }
110 /*if(searchThread.mode == directory)
111 ide.outputView.findDir = CopyString(searchThread.dir);
112 else if(searchThread.mode == project)
113 ide.outputView.findProject = searchThread.project;*/
114 property Project findProject
116 get { return searchThread.mode == project ? searchThread.project : null; }
119 property bool replaceMode
123 if(value != replaceMode)
125 int h = value ? 236 : 208;
126 find.text = value ? $"Replace" : $"Find";
127 find.hotKey = value ? altF : altR; // tocheck: the hotkey keeps getting lost
128 llreplaceWith.visible = value;
129 text = value ? $"Replace In Files" : $"Find In Files";
138 void AddProjectItem(Project project)
142 char label[MAX_FILENAME];
144 sprintf(label, $"%s Project", project.name);
145 row = findIn.AddString(label);
146 row.tag = (int64)project;
150 void RemoveProjectItem(Project project)
155 for(row = inWorkspaceRow.next; row; row = row.next)
157 if((Project)row.tag == project)
159 findIn.DeleteRow(row);
176 char currentDirectory[MAX_DIRECTORY];
177 FileFilter * filters;
180 DataRow inDirectoryRow;
181 DataRow inWorkspaceRow;
182 FindInFilesMode lastSelectionMode;
183 String lastSelectionProject;
184 String lastSelectionProjectNode;
186 SelectorButton starDir;
190 GetWorkingDir(currentDirectory, MAX_DIRECTORY);
191 FileFixCase(currentDirectory);
192 findWhere.path = currentDirectory;
193 findWherePrjNode.AddField(projectNodeField);
203 this, anchor = { left = 20, top = 4, right = 8, bottom = 0 };
204 direction = horizontal;
215 anchor.top = 0, anchor.bottom = 0;
219 LayoutLine llfindIn { lpmain, this, size.h = 26 };
220 LayoutLine llfindWhere { lpmain, this, size.h = 26 };
221 LayoutLine llsubDirs { lpmain, this, size.h = 18 };
222 LayoutLine llfilter { lpmain, this, size.h = 26 };
223 LayoutLine llfileName { lpmain, this, size.h = 26 };
224 LayoutLine llfindWhat { lpmain, this, size.h = 26 };
225 LayoutLine llwholeWord { lpmain, this, size.h = 18 };
226 LayoutLine llmatchCase { lpmain, this, size.h = 18 };
227 LayoutLine llreplaceWith { lpmain, this, size.h = 26, visible = false };
229 Label lfindIn { llfindIn, this, size.w = 72, labeledWindow = findIn };
232 llfindIn, this, $"Find in:", altI, anchor.right = 0;
234 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
236 FindInFilesMode mode = this.mode;
237 bool inDir = mode == directory;
238 bool inWrk = mode == workspace;
239 bool inPrj = mode == project;
241 lfindWhere.labeledWindow = findWherePrjNode;
243 lfindWhere.labeledWindow = findWhere;
244 findWhere.visible = !inPrj;
245 findWhere.disabled = !inDir;
246 findWherePrjNode.visible = inPrj;
247 subDirs.disabled = inWrk;
248 llfindWhere.size = { llfindWhere.size.w, llfindWhere.size.h };
253 lastSelectionMode = mode;
254 prj = lastSelectionMode == project ? (Project)row.tag : null;
255 delete lastSelectionProject;
259 ProjectNode node = prj.topNode;
260 char filePath[MAX_LOCATION];
261 prj.topNode.GetFullFilePath(filePath);
262 lastSelectionProject = CopyString(filePath);
263 findWherePrjNode.Clear();
264 ListProjectNodeFolders(node, null);
266 if(lastSelectionProjectNode && !(node = prj.topNode.FindByFullPath(lastSelectionProjectNode, false)))
269 delete lastSelectionProjectNode;
272 for(r = findWherePrjNode.firstRow; r; r = r.next)
273 if((ProjectNode)r.tag == node)
276 findWherePrjNode.SelectRow(r);
283 void ListProjectNodeFolders(ProjectNode node, DataRow parentRow)
287 row = findWherePrjNode/*parentRow*/.AddRow();
289 row = findWherePrjNode.AddRow();
290 row.tag = (int64)node;
291 row.SetData(null, node);
294 for(child : node.files; child.type == folder/* || child.type == file*//* || child.type == folderOpen*/)
295 ListProjectNodeFolders(child, row);
299 Label lfindWhere { llfindWhere, this, size.w = 72, labeledWindow = findWhere };
302 llfindWhere, this, $"Find where:", altH, size.h = 24, anchor.right = 0;
303 typeExpected = directory, browseDialog = fileDialog;
305 DropBox findWherePrjNode
307 llfindWhere, this, $"Find where:", altH, size.h = 24, anchor.right = 0;
309 //collapseControl = true, treeBranches = true;
311 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
315 ProjectNode node = (ProjectNode)row.tag;
316 delete lastSelectionProjectNode;
319 char filePath[MAX_LOCATION];
320 node.GetFullFilePath(filePath);
321 lastSelectionProjectNode = CopyString(filePath);
327 DataField projectNodeField { dataType = "ProjectNode", freeData = false };
329 Window spacerA { llsubDirs, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
332 llsubDirs, this, $"Include Subdirectories", altU, isCheckbox = true, checked = true;
335 Label lfilter { llfilter, this, size.w = 72, labeledWindow = filterDrop };
338 llfilter, this, $"Filter:", altL, anchor.right = 0;
340 bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
342 fileFilter = (int)(row ? row.tag : 0);
348 Label lfileName { llfileName, this, size.w = 72, labeledWindow = fileName };
351 llfileName, this, $"File name:", altN, size.h = 24, anchor.right = 0;
354 //Window spacerX { ll, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
355 //Button nameWholeWord { ll, this, "Whole word only", AltO, isCheckbox = true };
356 //Window spacerX { llwholeWord, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
357 //Button nameMatchCase { ll, this, "Match case", altA, isCheckbox = true };
359 Label lfindContent { llfindWhat, this, size.w = 72, labeledWindow = findContent };
362 llfindWhat, this, $"Find what:", altT, size.h = 24, anchor.right = 0;
365 Label lreplaceWith { llreplaceWith, this, size.w = 72, labeledWindow = replaceWith };
368 llreplaceWith, this, $"Replace with:", altE;
369 size.h = 24, anchor.right = 0;
372 Window spacerB { llwholeWord, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
373 Button contentWholeWord { llwholeWord, this, $"Whole word only", altW, isCheckbox = true };
375 Window spacerC { llmatchCase, this, size = { 72, 10 }, clickThrough = true, background = formColor, inactive = true };
376 Button contentMatchCase { llmatchCase, this, $"Match case", altC, isCheckbox = true };
383 anchor.top = 0, anchor.bottom = 0;
387 LayoutLine llspace { lpbuttons, this, size.h = 2 };
388 LayoutLine llfind { lpbuttons, this, size.h = 30 };
389 LayoutLine llcancel { lpbuttons, this, size.h = 30 };
393 llfind, this, $"Find", altF, isDefault = true, size = { 80, 24 }, anchor.horz = 0, anchor.vert = 0, keyRepeat = true;
395 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
397 String findPath = findWhere.path;
398 if(findIn.currentRow == inDirectoryRow && !findPath[0])
400 findWhere.Activate();
401 MessageBox { type = ok, master = parent,
402 text = text, contents = $"You must specify a search location." }.Modal();
404 else if(findIn.currentRow == inDirectoryRow && !FileExists(findPath))
406 findWhere.Activate();
407 MessageBox { type = ok, master = parent,
408 text = text, contents = $"Search location does not exist. Please provide a valid location." }.Modal();
410 else if(!fileName.contents[0] && !findContent.contents[0])
412 findContent.Activate();
413 MessageBox { type = ok, master = parent,
414 text = text, contents = $"Nothing to be found. Please specify at least one criteria." }.Modal();
418 findContent.Activate();
428 llcancel, this, $"Cancel", hotKey = { escape }, size = { 80, 24 }, anchor.horz = 0, anchor.vert = 0;
430 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
432 findContent.Activate();
438 SearchThread searchThread { findDialog = this };
439 FileDialog fileDialog { master = this, type = selectDir, text = $"Select Search Location..." };
444 inDirectoryRow = null;
445 inWorkspaceRow = null;
451 bool withWorkspace = (bool)ide.workspace;
454 inDirectoryRow = findIn.AddString($"Directory");
458 inWorkspaceRow = findIn.AddString($"Workspace");
459 for(prj : ide.workspace.projects)
461 if(lastSelectionProject)
463 for(row = findIn.firstRow; row; row = row.next)
465 char filePath[MAX_LOCATION];
466 Project p = (Project)row.tag;
469 p.topNode.GetFullFilePath(filePath);
470 if(!fstrcmp(filePath, lastSelectionProject))
475 findIn.SelectRow(row);
477 delete lastSelectionProject;
479 if(!lastSelectionProject)
481 if(lastSelectionMode == project)
483 Project prj = ide.workspace.projects.firstIterator.data;
484 for(row = findIn.firstRow; row; row = row.next)
485 if((Project)row.tag == prj)
488 findIn.SelectRow(row);
491 property::mode = lastSelectionMode;
496 findIn.SelectRow(inDirectoryRow);
499 findIn.disabled = !withWorkspace;
500 /*disabled = findIn.currentRow != inDirectoryRow;
502 findWhere.disabled = disabled;
503 subDirs.disabled = disabled;*/
505 findContent.Activate();
513 searchThread.active = true;
514 searchThread.project = null;
515 searchThread.projectNode = null;
516 searchThread.subDirs = subDirs.checked;
518 if(findIn.currentRow == inDirectoryRow)
520 searchThread.mode = directory;
521 strcpy(searchThread.dir, findWhere.slashPath);
523 else if(findIn.currentRow == inWorkspaceRow)
525 searchThread.mode = workspace;
526 searchThread.subDirs = true;
530 searchThread.mode = project;
531 searchThread.project = (Project)findIn.currentRow.tag;
532 searchThread.projectNode = (ProjectNode)(findWherePrjNode.currentRow ? findWherePrjNode.currentRow.tag : null);
534 //searchThread.nameMatchCase = nameMatchCase.checked;
535 //searchThread.nameWholeWord = nameWholeWord.checked;
536 searchThread.contentMatchCase = contentMatchCase.checked;
537 searchThread.contentWholeWord = contentWholeWord.checked;
539 searchThread.filter = filters[fileFilter];
541 strcpy(searchThread.nameCriteria, fileName.contents);
542 strcpy(searchThread.contentCriteria, findContent.contents);
544 strcpy(searchThread.contentReplace, replaceWith.contents);
545 searchThread.replaceMode = replaceMode;
547 //cancel.text = "Stop";
549 ide.outputView.ShowClearSelectTab(find);
553 searchThread.Create();
558 if(searchThread.active)
560 searchThread.Abort();
568 if(searchThread.active)
570 searchThread.Abort();
571 searchThread.Abort();
580 void SearchComplete()
582 //cancel.text = $"Cancel";
590 bool NotifyCharsAddedDeletedNameContent(EditBox editBox, BufferLocation before, BufferLocation after, bool pasteOperation)
592 find.disabled = (strlen(fileName.contents) == 0 && strlen(findContent.contents) == 0);
596 bool OnKeyHit(Key key, unichar ch)
600 findContent.Activate();
601 return findContent.OnKeyHit(key, ch);
607 class SearchThread : Thread
610 bool active, subDirs/*, nameMatchCase, nameWholeWord*/, contentMatchCase, contentWholeWord;
611 char dir[MAX_DIRECTORY], contentCriteria[1024], contentReplace[1024], nameCriteria[1024];
613 FindInFilesDialog findDialog;
614 FindInFilesMode mode;
616 ProjectNode projectNode;
629 bool abort, abortNow;
638 int HowManyDigits(int num)
651 int frame, treeTop = 0;
652 int globalFindCount = 0, filesSearchedCount = 0, filesMatchedCount = 0, dirsMatchedCount = 0;
653 //double lastTime = GetTime();
654 SearchStackFrame stack[1024];
655 FindInFilesMode mode = this.mode;
657 EditBox replaceEdit = null;
666 sprintf(substring, $" with file name matching \"%s\"", nameCriteria);
669 if(mode == directory)
672 ide.outputView.findBox.Logf(
673 $"Searching \"%s\"%s for %s%s%s containing \"%s\"\n\n",
674 (s = CopySystemPath(dir)), subDirs ? $" and its sub directories" : "",
675 filter.name, substring, substring[0] ? $" and" : "", contentCriteria);
678 else if(mode == workspace)
679 ide.outputView.findBox.Logf(
680 $"Searching workspace files for files%s%s containing \"%s\"\n\n",
681 substring, substring[0] ? $" and" : "", contentCriteria);
682 else if(mode == project)
683 ide.outputView.findBox.Logf(
684 $"Searching project %s files for files%s%s containing \"%s\"\n\n",
685 project.name, substring, substring[0] ? $" and" : "", contentCriteria);
691 replaceEdit = EditBox
693 multiLine = true,textHorzScroll = true,textVertScroll = true,
694 text = $"Replacing Editbox", size = Size { 640,480 }/*,maxLineSize = 65536*/
698 if(mode == directory)
700 strcpy(stack[0].path, dir);
701 stack[0].fileList = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
703 for(frame = 0; frame >= 0 && !abort; )
705 if(stack[frame].fileList.Find())
710 char name[MAX_LOCATION];
711 GetLastDirectory(stack[frame].fileList.path, name);
712 if(!(bool)SearchString(name, 0, nameCriteria, false, false))
715 if(!stack[frame].fileList.stats.attribs.isDirectory)
717 bool relative = false;
718 char fileRelative[MAX_LOCATION];
719 if(filter.ValidateFileName(stack[frame].fileList.name))
721 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
724 filesSearchedCount++;
725 if(match && contentCriteria[0])
730 ide.outputView.findBox.Tellf(
731 $"Searching %s for %s", relative ? fileRelative : stack[frame].fileList.path, contentCriteria);
735 ret = SearchFileContentAndReplace(stack[frame].fileList.path, relative, fileRelative, replaceEdit);
737 ret = SearchFileContent(stack[frame].fileList.path, relative, fileRelative);
740 globalFindCount += ret;
744 else if(match && nameCriteria[0])
748 ide.outputView.findBox.Logf(
750 relative ? fileRelative : stack[frame].fileList.path);
757 bool relative = false;
758 char fileRelative[MAX_LOCATION];
759 MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
762 if(match && nameCriteria[0])
765 ide.outputView.findBox.Logf(
767 relative ? fileRelative : stack[frame].fileList.path);
769 ide.outputView.findBox.Tellf(
770 $"Searching %s", relative ? fileRelative : stack[frame].fileList.path);
774 if(subDirs && stack[frame].fileList.stats.attribs.isDirectory && strcmp(stack[frame].fileList.name, ".git"))
776 int lastFrame = frame;
777 /*double thisTime = GetTime();
779 if(thisTime - lastTime > 0.25)
781 findDialog.SearchUpdateLabel(stack[lastFrame].fileList.path);
786 strcpy(stack[frame].path, stack[lastFrame].fileList.path);
787 stack[frame].fileList = FileListing { stack[frame].path, extensions = stack[lastFrame].fileList.extensions };
796 for( ; frame >= 0 ; frame--)
797 stack[frame].fileList.Stop();
799 else if(mode == workspace || mode == project)
802 char path[MAX_LOCATION];
803 bool firtIteration = true;
804 Project prj = project;
805 ProjectNode stack[1024];
806 Iterator<Project> it { ide.workspace.projects };
810 if(mode == workspace)
812 if(!it.Next()) break;
815 stack[1] = projectNode ? projectNode : prj.topNode;
817 for(frame = 1; frame && !abort;)
819 switch(stack[frame].type)
822 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
824 int lastFrame = frame;
826 stack[frame] = stack[lastFrame].files.first;
827 firtIteration = false;
832 bool relative = true;
833 char fileRelative[MAX_LOCATION];
834 char filePath[MAX_LOCATION];
836 PathCat(filePath, prj.topNode.path);
837 PathCat(filePath, stack[frame].path);
838 PathCat(filePath, stack[frame].name);
839 fileRelative[0] = '\0';
840 PathCat(fileRelative, stack[frame].path);
841 PathCat(fileRelative, stack[frame].name);
842 if(relative && mode == workspace && prj != ide.project)
844 char special[MAX_LOCATION];
845 sprintf(special, "(%s)%s", prj.name, fileRelative);
846 strcpy(fileRelative, special);
848 if(filter.ValidateFileName(stack[frame].name))
850 filesSearchedCount++;
851 if(!nameCriteria[0] || (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
853 if(contentCriteria[0])
858 ide.outputView.findBox.Tellf(
859 $"Searching %s for \"%s\"", relative ? fileRelative : filePath,
864 ret = SearchFileContentAndReplace(filePath, relative, fileRelative, replaceEdit);
866 ret = SearchFileContent(filePath, relative, fileRelative);
869 globalFindCount += ret;
873 else if(nameCriteria[0])
877 ide.outputView.findBox.Logf(
878 "%s\n", relative ? fileRelative : filePath);
883 stack[frame] = stack[frame].next;
888 bool relative = true;
889 char fileRelative[MAX_LOCATION];
890 char filePath[MAX_LOCATION];
892 PathCat(filePath, prj.topNode.path);
893 PathCat(filePath, stack[frame].path);
894 fileRelative[0] = '\0';
895 PathCat(fileRelative, stack[frame].path);
896 if(relative && mode == workspace && prj != ide.project)
898 char special[MAX_LOCATION];
899 sprintf(special, "(%s)%s", prj.name, fileRelative);
900 strcpy(fileRelative, special);
902 if(nameCriteria[0] && (bool)SearchString(stack[frame].name, 0, nameCriteria, false, false))
906 ide.outputView.findBox.Logf(
907 "%s\n", relative ? fileRelative : filePath);
910 if((subDirs || firtIteration) && stack[frame].files && stack[frame].files.count)
912 int lastFrame = frame;
914 stack[frame] = stack[lastFrame].files.first;
915 firtIteration = false;
918 stack[frame] = stack[frame].next;
922 stack[frame] = stack[frame].next;
925 while(frame && !stack[frame])
928 if(frame == 1 && projectNode && stack[frame] == projectNode)
931 stack[frame] = stack[frame].next;
934 if(mode == project) break;
938 for( ; frame ; frame--)
947 if(filesSearchedCount)
949 if(!contentCriteria[0] && (filesMatchedCount || dirsMatchedCount))
950 ide.outputView.findBox.Logf("\n");
952 ide.outputView.findBox.Logf(
953 $"%s search %s a total of %d match%s in %d out of the %d file%s searched\n",
954 abort ? $"Aborted" : $"Completed", replaceMode ? $"replaced" : $"found", globalFindCount, (globalFindCount > 1) ? $"es" : "",
955 filesMatchedCount, filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
956 else if(filesMatchedCount)
957 ide.outputView.findBox.Logf(
958 $"%s search found a total of %d match%s in the %d file%s searched\n",
959 abort ? $"Aborted" : $"Completed", filesMatchedCount, (filesMatchedCount > 1) ? $"es" : "",
960 filesSearchedCount, (filesSearchedCount > 1) ? $"s" : "");
962 ide.outputView.findBox.Logf(
963 $"%s search did not find any match in the %d files searched\n",
964 abort ? $"Aborted" : $"Completed", filesSearchedCount);
967 ide.outputView.findBox.Logf(
968 $"%s search did not find any file\n", abort ? $"Aborted" : $"Completed");
969 findDialog.SearchComplete();
974 int SearchFileContent(char *filePath, bool relative, char *fileRelative)
977 File f = FileOpen(filePath, read);
983 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
988 int inLineFindCount = 0;
990 while((find = SearchString(line, start, contentCriteria, contentMatchCase, contentWholeWord)) && !abortNow)
993 col = find - &line[start] + 1;
994 start += (find - &line[start]) / sizeof(char) + strlen(contentCriteria);
997 if(inLineFindCount && !abortNow)
1001 int len = strlen(line);
1002 s1[6 - HowManyDigits(lineNum)] = '\0';
1003 s2[4 - HowManyDigits(col)] = '\0';
1004 // Cut the line longer than 1024 because Logf prints to a buffer (and we don't want to output crazy long lines either)
1013 ide.outputView.findBox.Logf(
1014 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1015 lineNum, col, s1, s2, line);
1017 findCount += inLineFindCount;
1021 f.Seek(-strlen(contentCriteria), current);*/
1027 ide.outputView.findBox.Logf(
1028 $"Found %d match%s in \"%s\"%s\n\n", findCount, (findCount > 1) ? "es" : "",
1029 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1036 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1042 int SearchFileContentAndReplace(char *filePath, bool relative, char *fileRelative, EditBox edit)
1044 int replaceCount = -1;
1045 File f = FileOpen(filePath, read);
1050 while(f.GetLine(line, 65536/* should there be a - 1 here? */) && !abortNow)
1054 int inLineFindCount = 0;
1055 if(SearchString(line, 0, contentCriteria, contentMatchCase, contentWholeWord) && !abortNow)
1057 int lastLineNum = 0;
1062 for(; edit.Find(contentCriteria, contentWholeWord, contentMatchCase, true) == found; replaceCount++)
1064 int lineNum = edit.lineNumber + 1;
1065 edit.PutS(contentReplace);
1066 if(lineNum != lastLineNum)
1072 //int len = strlen(line);
1073 s1[6 - HowManyDigits(lineNum)] = '\0';
1074 s2[4 - HowManyDigits(col)] = '\0';
1075 strncpy(line, edit.line.text, 1023);
1078 // Cut the line longer than 1024 because Logf prints
1079 // to a buffer (and we don't want to output crazy long lines either)
1087 ide.outputView.findBox.Logf(
1088 " %s:%d:%d%s%s> %s\n", relative ? fileRelative : filePath,
1089 lineNum, col, s1, s2, line);
1095 if((f = FileOpen(filePath, write)))
1097 edit.Save(f, false);
1106 f.Seek(-strlen(contentCriteria), current);*/
1113 ide.outputView.findBox.Logf(
1114 $"Replaced %d match%s in \"%s\"%s\n\n", replaceCount, (replaceCount > 1) ? $"es" : "",
1115 relative ? fileRelative : filePath, abortNow ? $" before search was aborted" : "");
1122 ide.outputView.findBox.Logf($"Unable to open file %s\n\n", filePath);
1125 return replaceCount;
1129 static struct SearchStackFrame
1132 char path[MAX_LOCATION];
1133 FileListing fileList;