This is triggered by selecting part of an equation under Xcb platform
(x11). Indeed, the current selection has to be sent to the X11 server
and BufferView::requestSelection() is called. Eventually
cap::grabSelection() is the function that creates this partial
MathData object.
Fixes ticket #12947.
(cherry picked from commit ed2f3cb9cf)
Set the buffer of contents that is added to a MathData object through
MathData::insert() (both versions)
MathData::push_back()
asArray()
Also in math macros, initialize look_ with the relevant buffer.
This reduces the number of insets hat do not have a proper buffer.
See #13050 for discussion of this issue.
(cherry picked from commit f3c5ff9cb7)
Toolbars are now locked by default. Unlocked state should be saved
by Qt as a session variable.
Patch from Daniel.
(cherry picked from commit 42a8463aab)
The LFUN buffer-reset-export states to start afresh the export for the
next run, but in fact, the boolean was never reset, so that this was
done for all subsequent runs unless the buffer had been closed and
reopened.
Now the lfun does what it states and only acts on the next pass.
(cherry picked from commit e1cb15ee5d)
For example '\int '.
Should fix regression #13070
Spotted by Alexander Dunlap
(cherry picked from commit 4730ec78f5)
(cherry picked from commit 6c3447c8a6)
FragileFrame, as opposed to normal frame, supports cprotect (and needs
it in the usual circumstances)
(cherry picked from commit eeb3f9e719)
(cherry picked from commit 50cd148bd2)
It turns out beamer frame does not allow \cprotect and errors if it is
used. Hence we need to prevent it in this context entirely.
(cherry picked from commit 207eaeee90)
(cherry picked from commit f05fd78754)
The code that handles this special macro insertion (in
Cursor::mathMacroClose())) is very weird: it inserts the contents of
the macro _after_ the macro and later, since the macro is 'greedy', it
will eat this contents and put it in its first macro cell.
Does it make sense to you? It does not ake sense to me either. Anyway,
this is the point where one should make sure that the buffer is set.
Fixes ticket #12682.
(cherry picked from commit b45a957929)
When a buffer is reloaded, its content may remain the same, but the
memory allocation is new, so that the inset pointers in cursors are
now wrong. This requires to sanitize the cursors held by the buffer
views.
Before the biginset branch, some full metrics computation call that is
now removed probably did that as a side effect. Now we have to be more
precise.
To this effect, introduce WorkAreaManager::sanitizeCursors() and use
it in Buffer::reload().
(cherry picked from commit c1fd622c51)
This makes the class fully functional with non-TeX fonts (it uses
\babelfont for the purpose). Before, docs were compiling but the
output was wrong.
(cherry picked from commit c3c96a446b)
Now that SingleParUpdate does not always lead to a full screen update
when the height of the paragraph changes (see new behavior of
updateMatrics(bool)), it is necessary to make sure that the grey area
below the main page is always repainted.
(cherry picked from commit 1a11abe439)
With the branch-test.lyx file from #12297, loading takes forever when
previews are activated. This is because each preview element causes a
full screen metrics recomputation.
This commit just skips these calls and only does one when all previews
have been obtained. As a result, computing the previews takes 1 second
instead of 25 seconds on branch-test.lyx.
Part of bug #12297.
(cherry picked from commit 2449693301)
The most visible part of this commit is the move of part of
BufferView::updateMetrics to a new TextMetrics::updateMetrics. This
new method makes sure that metrics are known for all visible paragraphs
(starting from anchor), and that the positions of the paragraphs have
been recorded.
This method is called up to 3 times in BufferView::updateMetrics:
* unconditionally, to update all visible metrics,
* then, if the bottom of the document is visible and too high, after
updating the anchor ypos,
* and similarly if the top of the document is visible and too low.
This fixes for example the case where one jumps to Section 5.3 at the
end of Tutorial and 'scroll_below_document' is false.
Some now redundant code is removed from BufferView::scrollToCursor.
The anchor-setting code in BufferView::draw is not clearly useful, but
left here just in case. It generates a debug warning, though.
Part of bug #12297.
(cherry picked from commit f15d2ebf38)
Replace flag parameter for updateMetrics() by a `force' boolean. When
it is false, the method keeps the metrics of paragraphs that are still
visible in WorkArea instead of computing everything afresh. All it has
to do is update their positions.
Add code to updateMetrics() to update the value of the anchor pit/ypos
(similar to the one in draw()).
Update processUpdateFlags() to use this when update flag is ForceDraw.
Modify scrollDocView() to just change the anchor paragraph position
when the scrolling operation would re-use some of the existing
paragraphs.
The time needed to update the metrics when scrolling with mouse in the
branch-test.lyx document is now divided by 20!
Part of bug #12297.
(cherry picked from commit 08010c6a5e)
This can make a big difference for a very large branch that contains
lots of equations.
This is complementary to the previous patch, since instead of reducing
the number of calls to updatePosCache, we make it faster.
In the same test of scrolling with mouse wheel through the
branch-test.lyx document, one finds a 23% improvement for
BufferView::updateMetrics().
Part of bug #12297.
(cherry picked from commit 7f85024f80)
The setting of insets positions was done twice in updateMetrics.
When one of the paragraph is a huge branch, this can be very expensive.
This leads to a 17% improvement on updateMetrics time on a scrolling test.
Part of bug #12297
(cherry picked from commit d19ade9a61)
The idea of single par update is to try to re-break only the paragraph
containing the cursor (if this paragraph contains insets etc.,
re-breaking will recursively descend).
The existing single paragraph update mechanism was tailored to work
only at top level. Indeed changing a paragraph nested into an inset may
lead to larger changes.
This commit tries a rather naive approach that seems to work well: we
need a full redraw if either
1/ the height has changed
or
2/ the width has changed and it was equal to the text metrics width;
the goal is to catch the case of a one-row inset that grows with
its contents, but optimize the case of typing in a short paragraph
part of a larger inset.
NOTE: if only the height has changed, then it should be
possible to update all metrics at minimal cost. However,
since this is risky, we do not try that right now.
Part of bug #12297.
(cherry picked from commit 9a96726bcd)
We were doing this on every mouse movement. I.e., for every single
pixel the mouse traverses. It can be expensive if there are a lot
of math insets.
(cherry picked from commit 4e8aa89eb9)