mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Fix random scrolling inside nested insets
Happened when the BufferView was resized (e.g. math toolbars were displayed/hidden). Backported from gadmm's lyx-unstable tree https://gitlab.com/gadmm/lyx-unstable/-/commit/a868bc034cea4c Possible fix to bug #7457.
This commit is contained in:
parent
2eab3d2e06
commit
fbf22bb3f3
@ -954,7 +954,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
|
|||||||
LYXERR(Debug::SCROLLING, "scrolling to cursor");
|
LYXERR(Debug::SCROLLING, "scrolling to cursor");
|
||||||
|
|
||||||
CursorSlice const & bot = dit.bottom();
|
CursorSlice const & bot = dit.bottom();
|
||||||
TextMetrics & tm = d->text_metrics_[bot.text()];
|
TextMetrics & tm = textMetrics(bot.text());
|
||||||
|
|
||||||
pos_type const max_pit = pos_type(bot.text()->paragraphs().size() - 1);
|
pos_type const max_pit = pos_type(bot.text()->paragraphs().size() - 1);
|
||||||
pos_type bot_pit = bot.pit();
|
pos_type bot_pit = bot.pit();
|
||||||
@ -1021,8 +1021,10 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
|
|||||||
|
|
||||||
d->anchor_pit_ = bot_pit;
|
d->anchor_pit_ = bot_pit;
|
||||||
CursorSlice const & cs = dit.innerTextSlice();
|
CursorSlice const & cs = dit.innerTextSlice();
|
||||||
|
ParagraphMetrics const & inner_pm =
|
||||||
|
textMetrics(cs.text()).parMetrics(cs.pit());
|
||||||
Dimension const & row_dim =
|
Dimension const & row_dim =
|
||||||
pm.getRow(cs.pos(), dit.boundary()).dim();
|
inner_pm.getRow(cs.pos(), dit.boundary()).dim();
|
||||||
|
|
||||||
if (recenter)
|
if (recenter)
|
||||||
d->anchor_ypos_ = height_/2;
|
d->anchor_ypos_ = height_/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user