Fixed display of SearchLogWidget when resizing, fixed doing multiple searches not working

Also made the LogWidget not scroll to bottom.
This commit is contained in:
Hans-Albert Maritz 2015-03-09 01:11:39 +11:00
parent d6cffd4e2e
commit 19271b6233
2 changed files with 18 additions and 25 deletions

View File

@ -16,6 +16,8 @@ class SearchLogWidget : LogWidget {
this(string ID){ this(string ID){
super(ID); super(ID);
scrollLock = false;
} }
override protected CustomCharProps[] handleCustomLineHighlight(int line, dstring txt, ref CustomCharProps[] buf) { override protected CustomCharProps[] handleCustomLineHighlight(int line, dstring txt, ref CustomCharProps[] buf) {
@ -92,7 +94,8 @@ class SearchWidget : TabWidget {
this(string ID, IDEFrame frame) { this(string ID, IDEFrame frame) {
super(ID); super(ID);
_frame = frame; _frame = frame;
layoutHeight(FILL_PARENT);
//Remove title, more button //Remove title, more button
removeAllChildren(); removeAllChildren();
@ -115,17 +118,17 @@ class SearchWidget : TabWidget {
_resultLog = new SearchLogWidget("SearchLogWidget"); _resultLog = new SearchLogWidget("SearchLogWidget");
_resultLog.layoutHeight(FILL_PARENT); _resultLog.layoutHeight(FILL_PARENT);
addChild(_resultLog); addChild(_resultLog);
} }
void searchInProject(ProjectItem project, ref SearchMatchList[] matchList, dstring text) { void searchInProject(ProjectItem project, ref SearchMatchList[] matchList, dstring text) {
if(project.isFolder) { if(project.isFolder == true) {
foreach(ProjectItem child; cast(ProjectFolder) project) { ProjectFolder projFolder = cast(ProjectFolder) project;
searchInProject(child, matchList, text); for(int i = 0; i < projFolder.childCount; i++) {
} searchInProject(projFolder.child(i), matchList, text);
}
} }
else { else {
Log.d("Searching in: " ~ project.filename);
EditableContent content = new EditableContent(true); EditableContent content = new EditableContent(true);
content.load(project.filename); content.load(project.filename);
SearchMatchList match; SearchMatchList match;
@ -141,16 +144,21 @@ class SearchWidget : TabWidget {
if(match.matches.length > 0) { if(match.matches.length > 0) {
matchList ~= match; matchList ~= match;
} }
} }
} }
bool findText(dstring source) { bool findText(dstring source) {
Log.d("Finding " ~ source); Log.d("Finding " ~ source);
SearchMatchList[] matches; SearchMatchList[] matches;
_resultLog.text = ""d;
//TODO Should not crash when in homepage. //TODO Should not crash when in homepage.
foreach(Project project; _frame._wsPanel.workspace.projects) { foreach(Project project; _frame._wsPanel.workspace.projects) {
Log.d("Searching in project " ~ project.filename);
searchInProject(project.items, matches, source); searchInProject(project.items, matches, source);
} }
if(matches.length == 0) { if(matches.length == 0) {
@ -166,4 +174,4 @@ class SearchWidget : TabWidget {
} }
return true; return true;
} }
} }

View File

@ -63,7 +63,7 @@ class ProjectItem {
} }
/// returns true if item is folder /// returns true if item is folder
@property bool isFolder() { @property const bool isFolder() {
return false; return false;
} }
/// returns child object count /// returns child object count
@ -84,7 +84,7 @@ class ProjectFolder : ProjectItem {
super(filename); super(filename);
} }
@property override bool isFolder() { @property override const bool isFolder() {
return true; return true;
} }
@property override int childCount() { @property override int childCount() {
@ -135,21 +135,6 @@ class ProjectFolder : ProjectItem {
return path; return path;
return buildNormalizedPath(_filename, path); return buildNormalizedPath(_filename, path);
} }
int begin;
int end;
bool empty() const {
return begin == _children.count;
}
void popFront()
{
++begin;
}
ProjectItem front() {
return _children[begin];
}
} }
/// Project source file /// Project source file