The code in InsetLabel::updateReferences code changes reference insets
in potentially several buffers. When recording undo, it is important
to use the right undo stack, otherwise crashes can ensue.
Once it is done, it is neccessary to create undo groups as needed.
This is done using UndoGroupHelper. This demonstrates a shortcoming of
UndoGroupHelper: if a buffer is encountered in two seperate
occasions, two undo groups will be created for this buffer. This is
not correct.
Fixes bug #10643.
(cherry picked from commit 4eb9b50dc642a3532d8126a93571696b3db57640)
It was not a good idea to rely on QTextLine::naturalTextWidth() to
compute a string width. The correct method is horizontalAdvance().
Also round the value to the nearest pixel, since this is what
QFontMetrics::width() does.
By contrast with the code in 2.3.x/master, this code had to be adapted
for Qt < 4.7, where horizontalAdvance() is not defined and
naturalTextWidth() has to be used instead. The fix is thus only
effective starting from Qt 4.7.
Fixes bug #10700 (and maybe others).
(cherry picked from commit c874641e95b763a6d4691fb12fba893580f3018a)
The renaming happened in 2013. Contrary to what is stated in the
babel-vietnamese manual, option "vietnam" does not work anymore.
Also, the special care is not needed anymore, since language options
are not hardcoded anymore in babel.
Fixes: #10743
We do not want the cleanup work to be interrupted by a buffer exception.
Spotted by coverity. See bug #9979 for discussion.
(cherry picked from commit 0d565f7b350b4dfecfa9337b4b80173282d191ab)
This is a consequence of 060a9664, although it is not clear why. The
contextMenuEvent code of the workarea should not delegate context
menu when it cannot honor it.
Also fix a small memory leak.
Fixes bug #10616.
(cherry picked from commit ab81c23656b59aa14c41b8acc45f0f3e410ed785)
This fixes an error in the preview generation with polyglossia
and bidi that prevents snippet generation (and consequently also
"math as image" xhtml output).
Fixes: #10716.
In some (not yet understood) situations, the paragraph metrics cache
is empty in generateSyntheticMouseEvent(). We just avoid a crash in
this case, but there is probably an underlying problem that deserves
being fixed.
Fixes bug #10324.
(cherry picked from commit 4efb129ccba448edfb851741089d70b0bfd054a3)
While 1c07c0dc was too strong and broke mathed, 4499680b is too
lenient and can accept insets (mathed/CommandInset, InsetInfo) that
have a positive nargs() but are not editable (because they encapsulate
something).
Therefore the best solution for now is to use editable() in text and
isActive() in mathed, until those two things are merged.
Part of #10667.
(cherry picked from commit 13c3c1485b68980c51658cef8fadf804982d75ee)
This is a relic from IU (Inset Unification): editable() is for text
insets and isActive() for mathed. This needs to be cleaned up.
Part of bug #10667.
(cherry picked from commit d0acc3e570447b293169b8bdd5ac67aaade189e0)
Without this setCurrentFont() is not correctly called on the
BufferView cursor and the cursor could appear in L-form.
Fixes bug #10686.
(cherry picked from commit 5d7dae9e382f0b01800f5652e673e12fa6923740)
This issue was already addressed in the all_sel case. It only happens
at specific zoom and jusification values.
Fixes part of #8883.
(cherry picked from commit 71563835c7943ea987a5d967b79ec90cb2b3c26e)
The test added at 359aef92 was incorrect. Actually, Inset::editXY
returns the inset when it is edited and also when it is not, which
can be confusing. So if we are unlucky and the slices positions in the
text area and in the inner inset match, the code below triggers and
many bad things can happen.
Also improve the documentation of Inset::editXY and TextMetrics::editXY.
Fixes#10691.
(cherry picked from commit c9fefd5a2cf5eb97fb23279e5b5e2f4c3a19b22e)
Make sure to properly nest \begin{lang} and \end{lang} tags even
when no language package is selected. In this case, LyX assumes
that babel is being used, so the language names might be wrong
if the user arranged for using polyglossia in the preamble.
Nevertheless, we assure that the produced output is syntactically
correct, so that by adding proper preamble code a correct output
is still possible.
As it was, the comparison buffer was sharing a DocumentClass with
the buffer from which the document settings are taken.
(cherry picked from commit f9835d054d7aac5830ec6bb5a3537c2b4fa2d269)
It seems that the internal Qt5 caching does not work well here,
especially in the case of ancient Hebrew documents.
(cherry picked from commit 5354c64b273eac7b869ca44436db7088d8c73bb4)
When an inset wants to use the whole available width, it is necessary
to take into account that some of this width may already be taken by
the end-of-paragraph (pilcrow) marker.
Fixes bug #10537.
(cherry picked from commit 91f3b21e42c7b3b2028ec8f66460440e9ddadcbf)
getPosNearX, which is the only user of x2pos, should always return the
nearest position.
In editXY, there is a need to return the position where the inset
stands, but it is done using checkInsetHit.
Fixes part of bug #10569.
(cherry picked from commit 8769c0fb750a8c46e6f053c5f73b3991393dcd73)
(cherry picked from commit 20696ecb7ee335dedcc8a1b0d24e4cc56736d81f)
The code that looks whether neighbor block has a different direction
should look to the left or to the right depending on the direction of
the current block.
Fixes part of bug #10569
(cherry picked from commit e3d252cd6256b32745b93c0cb0fd5170f448f91c)