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 0d565f7b35)
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 ab81c23656)
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 4efb129ccb)
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 13c3c1485b)
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 d0acc3e570)
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 5d7dae9e38)
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 71563835c7)
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 c9fefd5a2c)
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 f9835d054d)
It seems that the internal Qt5 caching does not work well here,
especially in the case of ancient Hebrew documents.
(cherry picked from commit 5354c64b27)
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 91f3b21e42)
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 8769c0fb75)
(cherry picked from commit 20696ecb7e)
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 e3d252cd62)
Instead of using complicated (and wrong) code, it is better to use
getPosNearX here.
Also simplify the code by removing temporary variables.
Fixes part of #10569.
(cherry picked from commit 6a0c1c6573)
With RtL text, the method can be non-monotonic wrt x value (which is a
Qt bug). To work around this, we check whether positions adjacent to
those returned by xToCursor look better. Depending on whether the new
x position is too small or too large, we look backward or forward for
a better solution.
The performance is probably not great, but this is only needed for
user interactions, so the performance penalty should not be a problem.
Fixes part of #10569.
(cherry picked from commit da590925cd)
This is a regression at b0673bd1. The code referred to row.pit(),
which was not correctly initialized in this case. The bug does not
exist in master, since the code in redoParagraph has been cleaned-up
and row.pit() is always correct.
Two corrective measures are taken, each of which would fix the bug:
- do not use row.pit() in breakRow, but directly the pit parameter.
- initialize row.pit() correctly in the faulty case.
When including files, LyX always searches the user and the system
directory, in that order. This means that when using local layout
files broken down into multiple includes, the various includes should
be specified with a path relative to the user layouts directory
(typically ~/.lyx/layouts), making this very impractical.
This commit allows including local files by specifying their path
as explicitly relative to the main layout file position, i.e., by
specifying their path with either "./" or "../". If the main layout
is not loaded from a local file, the usual search order is used,
even if the path are explicitly relative. So, for system layouts,
both "Input ./name.inc" and "Input name.inc" are equivalent.
(cherry picked from commit 17ab47b3e6)
Because latex allows to do so, and there is no easy way to achieve this.
This was apparently implemented to allow cycling between the various dash
types, but it was a bad idea bringing no benefit and causing griefs.