patch by Vasilis Kaoutsis: removed the use of goto

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20147 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-02-17 13:35:40 +00:00
parent 0ba2462a6d
commit f082d94258
+16 -14
View File
@@ -2229,36 +2229,33 @@ TermView::Find (const BString &str, bool forwardSearch, bool matchCase, bool mat
offset = (selectionstart.y) * fTermColumns + selectionstart.x; offset = (selectionstart.y) * fTermColumns + selectionstart.x;
} }
restart: for (;;) {
//Actual search //Actual search
if (forwardSearch) { if (forwardSearch) {
if (matchCase) { if (matchCase)
result = buffer.FindFirst(str, offset); result = buffer.FindFirst(str, offset);
} else { else
result = buffer.IFindFirst(str, offset); result = buffer.IFindFirst(str, offset);
}
} else { } else {
if (matchCase) { if (matchCase)
result = buffer.FindLast(str, offset); result = buffer.FindLast(str, offset);
} else { else
result = buffer.IFindLast(str, offset); result = buffer.IFindLast(str, offset);
} }
}
if (result == B_ERROR) { //Wrap search like Be's Terminal if (result == B_ERROR) { //Wrap search like Be's Terminal
if (forwardSearch) { if (forwardSearch) {
if (matchCase) { if (matchCase)
result = buffer.FindFirst(str, 0); result = buffer.FindFirst(str, 0);
} else { else
result = buffer.IFindFirst(str, 0); result = buffer.IFindFirst(str, 0);
}
} else { } else {
if (matchCase) { if (matchCase)
result = buffer.FindLast(str, buffer.Length()); result = buffer.FindLast(str, buffer.Length());
} else { else
result = buffer.IFindLast(str, buffer.Length()); result = buffer.IFindLast(str, buffer.Length());
} }
} }
}
if (result < 0) if (result < 0)
return false; return false;
@@ -2273,8 +2270,13 @@ restart:
offset = result + str.Length(); offset = result + str.Length();
else else
offset = result; offset = result;
goto restart; continue;
} }
else
break;
}
else
break;
} }
//Select the found text //Select the found text