fix display when jumping to a toc entry

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9606 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-02-09 11:27:21 +00:00
parent d436597a44
commit d20ac26754
3 changed files with 31 additions and 27 deletions

View File

@ -965,6 +965,7 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
case LFUN_INSERT_LABEL:
case LFUN_BOOKMARK_SAVE:
case LFUN_REF_GOTO:
case LFUN_GOTO_PARAGRAPH:
case LFUN_WORD_FIND:
case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF:
@ -1088,6 +1089,26 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
break;
}
case LFUN_GOTO_PARAGRAPH: {
int const id = convert<int>(cmd.argument);
ParIterator par = buffer_->getParFromID(id);
if (par == buffer_->par_iterator_end()) {
lyxerr[Debug::INFO] << "No matching paragraph found! ["
<< id << ']' << endl;
break;
} else {
lyxerr[Debug::INFO] << "Paragraph " << par->id()
<< " found." << endl;
}
// Set the cursor
bv_->setCursor(par, 0);
update();
switchKeyMap();
break;
}
case LFUN_TRACK_CHANGES:
trackChanges();
break;

View File

@ -1,3 +1,13 @@
2005-02-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* BufferView_pimpl.C (dispatch): handle LFUN_GOTO_PARAGRAPH here,
but use update() to get correct screen display; use convert
instead of istringstream.
(getStatus): handle LFUN_GOTO_PARAGRAPH
* lyxfunc.C (dispatch, getStatus): do not handle
LFUN_GOTO_PARAGRAPH here.
2005-02-08 Lars Gullik Bjonnes <larsbj@gullik.net>
* text3.C (dispatch): size() -> depth()

View File

@ -547,7 +547,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
case LFUN_GETNAME:
case LFUN_NOTIFY:
case LFUN_GOTOFILEROW:
case LFUN_GOTO_PARAGRAPH:
case LFUN_DIALOG_SHOW_NEXT_INSET:
case LFUN_DIALOG_HIDE:
case LFUN_DIALOG_DISCONNECT_INSET:
@ -1101,32 +1100,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
break;
}
case LFUN_GOTO_PARAGRAPH: {
istringstream is(argument);
int id;
is >> id;
ParIterator par = owner->buffer()->getParFromID(id);
if (par == owner->buffer()->par_iterator_end()) {
lyxerr[Debug::INFO] << "No matching paragraph found! ["
<< id << ']' << endl;
break;
} else {
lyxerr[Debug::INFO] << "Paragraph " << par->id()
<< " found." << endl;
}
// Set the cursor
view()->setCursor(par, 0);
view()->switchKeyMap();
owner->view_state_changed();
view()->center();
// see BufferView_pimpl::center()
view()->updateScrollbar();
break;
}
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
string data = trim(cmd.argument.substr(name.size()));