Move LFUN_WORD_FIND_FORWARD and LFUN_WORD_FIND_BACKWARD to their friends in BufferView.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31358 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-09-09 05:20:30 +00:00
parent b53b9b9941
commit d4d8d03153
2 changed files with 24 additions and 26 deletions

View File

@ -922,6 +922,8 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_NOTE_NEXT: case LFUN_NOTE_NEXT:
case LFUN_REFERENCE_NEXT: case LFUN_REFERENCE_NEXT:
case LFUN_WORD_FIND: case LFUN_WORD_FIND:
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD:
case LFUN_WORD_FINDADV: case LFUN_WORD_FINDADV:
case LFUN_WORD_REPLACE: case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF: case LFUN_MARK_OFF:
@ -1225,6 +1227,28 @@ bool BufferView::dispatch(FuncRequest const & cmd)
processUpdateFlags(Update::Force | Update::FitCursor); processUpdateFlags(Update::Force | Update::FitCursor);
break; break;
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD: {
static docstring last_search;
docstring searched_string;
if (!cmd.argument().empty()) {
last_search = cmd.argument();
searched_string = cmd.argument();
} else {
searched_string = last_search;
}
if (searched_string.empty())
break;
bool const fw = cmd.action == LFUN_WORD_FIND_FORWARD;
docstring const data =
find2string(searched_string, true, false, fw);
find(this, FuncRequest(LFUN_WORD_FIND, data));
break;
}
case LFUN_WORD_FIND: { case LFUN_WORD_FIND: {
FuncRequest req = cmd; FuncRequest req = cmd;
if (cmd.argument().empty() && !d->search_request_cache_.argument().empty()) if (cmd.argument().empty() && !d->search_request_cache_.argument().empty())

View File

@ -630,8 +630,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
break; break;
} }
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD:
case LFUN_WORD_FINDADV: case LFUN_WORD_FINDADV:
case LFUN_COMMAND_PREFIX: case LFUN_COMMAND_PREFIX:
case LFUN_COMMAND_EXECUTE: case LFUN_COMMAND_EXECUTE:
@ -828,30 +826,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
buffer = &lyx_view_->currentBufferView()->buffer(); buffer = &lyx_view_->currentBufferView()->buffer();
switch (action) { switch (action) {
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD: {
LASSERT(lyx_view_ && lyx_view_->documentBufferView(), /**/);
static docstring last_search;
docstring searched_string;
if (!cmd.argument().empty()) {
last_search = cmd.argument();
searched_string = cmd.argument();
} else {
searched_string = last_search;
}
if (searched_string.empty())
break;
bool const fw = action == LFUN_WORD_FIND_FORWARD;
docstring const data =
find2string(searched_string, true, false, fw);
find(lyx_view_->documentBufferView(),
FuncRequest(LFUN_WORD_FIND, data));
break;
}
case LFUN_COMMAND_PREFIX: case LFUN_COMMAND_PREFIX:
LASSERT(lyx_view_, /**/); LASSERT(lyx_view_, /**/);
lyx_view_->message(keyseq.printOptions(true)); lyx_view_->message(keyseq.printOptions(true));