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

View File

@ -63,7 +63,7 @@ class ProjectItem {
}
/// returns true if item is folder
@property bool isFolder() {
@property const bool isFolder() {
return false;
}
/// returns child object count
@ -84,7 +84,7 @@ class ProjectFolder : ProjectItem {
super(filename);
}
@property override bool isFolder() {
@property override const bool isFolder() {
return true;
}
@property override int childCount() {
@ -135,21 +135,6 @@ class ProjectFolder : ProjectItem {
return 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