}
else {
if (!editor.getSelectionModel().hasSelection()) {
findManager.setFindNextModel(null);
return;
<BUG>}
if (model.isForward()) {
offset = editor.getSelectionModel().getSelectionStart();
}
else {
offset = editor.getSelectionModel().getSelectionEnd();
}</BUG>
}

}
int offset;
if (model.isGlobal()) {
if (model.isFromCursor()) {
offset = editor.getCaretModel().getOffset();
}
else {
offset = model.isForward() ? 0 : editor.getDocument().getTextLength();
}
}
else {
if (!editor.getSelectionModel().hasSelection()) {
