For example '\int '.
Should fix regression #13070
Spotted by Alexander Dunlap
(cherry picked from commit 4730ec78f5)
(cherry picked from commit 6c3447c8a6)
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)
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)
\ was transformed very early to \textbackslash{}, but then the following
routines escaped braces in the string, so we wrongly ended up in
\textbackslash\{\} and "\{} in the output
This is a kind of hack. This allows InsetMathHull to state that it
needs some elbow room beyond its width, in order to fit the numbering
and/or the left margin (with left alignment), which are outside of the
inset itself.
To this end, InsetMathHull::metrics() sets a value in
MetricsInfo::extrawidth and this value is added later to the width of
the row that contains the inset (when this row is tight or shorter
than the max allowed width).
Fixes bug #12320.
The previous commit introduced wrong behaviours for <>. The new code carefully escapes what needs to be escaped from LaTeX, using the now-standard XML tools (XMLStream).
In some cases (I only found numbered equations), the LaTeX output still has a bit of HTML. For numbered equations, using \tag{X} (as suggested in https://www.lyx.org/trac/ticket/13048) would require fiddling with the output. KaTeX doesn't support \label. This patch is probably the easiest and most reliable fix.
Fixes https://www.lyx.org/trac/ticket/13048.
xcode fails with multiple error messages like this one:
----------
CMake Error in po/CMakeLists.txt:
The custom command generating
<build-directory>/po/LyX2.4.cat.pot
is attached to multiple targets:
translations
update-gmo
but none of these is a common dependency of the other(s). This is not
allowed by the Xcode "new build system".
The preview loader assumes all content is in the main document encoding.
As soon as content was not encodable, LyX crashed. We now check for that
and if non-encodable glyphs are found, we do not produce a preview snippet
and warn.
Ideally, the preview loader should be made aware of encoding changes, or
we should generally use utf8 for previews.
The main goal is to match TeX' behaviour. If you want stretchy operators, use InsetMathDelim / \left & \right. This patch will change the output in many files, but making the rendering much closer to that of TeX (which users should expect, due to LyX' roots in TeX).