mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
More accurate toc navigation (LFUN_PARAGRAPH_GOTO).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24798 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fc22b68e37
commit
2dfc84a22c
@ -1055,7 +1055,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_PARAGRAPH_GOTO: {
|
||||
int const id = convert<int>(to_utf8(cmd.argument()));
|
||||
int const id = convert<int>(cmd.getArg(0));
|
||||
int const pos = convert<int>(cmd.getArg(1));
|
||||
int i = 0;
|
||||
for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
|
||||
b = theBufferList().next(b)) {
|
||||
@ -1072,6 +1073,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
|
||||
if (b == &buffer_) {
|
||||
// Set the cursor
|
||||
dit.pos() = pos;
|
||||
setCursor(dit);
|
||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||
} else {
|
||||
|
@ -76,7 +76,9 @@ docstring const TocItem::asString() const
|
||||
|
||||
FuncRequest TocItem::action() const
|
||||
{
|
||||
return FuncRequest(LFUN_PARAGRAPH_GOTO, convert<string>(id()));
|
||||
string const arg = convert<string>(dit_.paragraph().id())
|
||||
+ ' ' + convert<string>(dit_.pos());
|
||||
return FuncRequest(LFUN_PARAGRAPH_GOTO, arg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,13 +219,9 @@ void TocModels::goTo(int type, QModelIndex const & index) const
|
||||
}
|
||||
|
||||
LASSERT(type >= 0 && type < int(models_.size()), /**/);
|
||||
|
||||
TocIterator const it = models_[type]->tocIterator(index);
|
||||
|
||||
LYXERR(Debug::GUI, "TocModels::goTo " << it->str());
|
||||
|
||||
string const tmp = convert<string>(it->id());
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
|
||||
dispatch(it->action());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user