Commit Graph

36016 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
4db40b11af Use the proper buffer when recording undo
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 4eb9b50dc6)
2017-09-03 18:35:37 +02:00
Jean-Marc Lasgouttes
8ff22de938 When a row is shortened, reset its flushed() attribute.
Fixes bug #10699.

(cherry picked from commit 59e2c40564)
2017-09-03 18:34:01 +02:00
Jean-Marc Lasgouttes
48904cc5a1 Fix computation of string width when using a QTextLayout
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 c874641e95)
2017-08-29 15:15:39 +02:00
Jean-Marc Lasgouttes
6b0509da0c Small update to README 2017-08-29 12:20:07 +02:00
Juergen Spitzmueller
86e54f6cc7 Babel option for Vietnamese is called "vietnamese"
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
2017-08-13 18:43:26 +02:00
Juergen Spitzmueller
f1428488b1 Add missing break
As correctly pointed out by gcc7.
2017-08-13 09:32:51 +02:00
Uwe Stöhr
4cb45dfffe Win installer: check for a package that LyX uses for instant preview 2017-08-05 20:27:01 +02:00
Uwe Stöhr
8f476415ea status.22x: move crash fixes up
- also correct a bug number
2017-07-26 01:32:36 +02:00
Juergen Spitzmueller
5eda278c80 Properly import \newtheorem*
Fixes: #10622
2017-07-25 18:28:47 +02:00
Uwe Stöhr
ef5ff9f43e Win installer: prepare for a new 2.2.4 release 2017-07-25 00:33:04 +02:00
Jean-Marc Lasgouttes
e4aba6e17c When cleaning up before quitting, take care of exceptions
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)
2017-07-17 10:49:50 +02:00
Jean-Marc Lasgouttes
311a40747e Remove test that is not needed.
We know that buf is not null at this point.

Spotted by coverity.
2017-07-17 10:39:09 +02:00
Juergen Spitzmueller
f61e88b7dd Update parent buffer as soon as a child has been released
This prevents dangling pointers that might crash LyX.

Fixes: #9979.
2017-07-17 10:34:58 +02:00
Jean-Marc Lasgouttes
e5105a0dce Do not use toobar menu as fallback context menu
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)
2017-07-15 16:21:41 +02:00
Juergen Spitzmueller
476705ba76 Load color before polyglossia also in preview snippets
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.
2017-07-15 15:05:34 +02:00
Enrico Forestieri
0237292eb1 Fix bug #10546
A labeled equation is also numbered.
2017-07-09 23:31:33 +02:00
Jean-Marc Lasgouttes
4fbb0f1770 Avoid crash when selecting long text
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)
2017-07-05 10:59:26 +02:00
Juergen Spitzmueller
9c0dd478df Catch xdvipdfmx driver error (that breaks XeTeX compilation).
This prevents an assertion due to an unrecognized error.

Fixes: #10076.
2017-07-04 10:48:45 +02:00
Juergen Spitzmueller
678f3e7589 natbibapa.module: Do not overwrite preamble.
Also add author information.
2017-07-03 16:28:40 +02:00
Jean-Marc Lasgouttes
869174e295 Fixup the fixup 4499680b: use editable()/isActive()
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)
2017-07-03 11:59:24 +02:00
Enrico Forestieri
68bc505029 Fix bug #10705
Seemingly, std::regex does not account for newlines in the string.
2017-06-26 23:10:30 +02:00
Jean-Marc Lasgouttes
4499680bd9 Fixup 1c07c0dc: editable() is unusable in mathed
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)
2017-06-20 09:52:21 +02:00
Guillaume MM
ba5e8c443e Fix crash with full view source (#10560 and #10617) 2017-06-17 20:05:59 +02:00
Jean-Marc Lasgouttes
1c07c0dc38 Make fixIfBroken() more robust
Chop slice when its inset is not editable.

Fixes bug #10667.

(cherry picked from commit 522516d99e)
2017-06-17 13:07:36 +02:00
Juergen Spitzmueller
f7aabdd9fa Catch "! Incomplete \\if[x]" error
Fixes: #10666
2017-06-16 10:05:12 +02:00
Jean-Marc Lasgouttes
5f08a1b41d When entering an inset by cursor, reset boundary
This happens when cursor-left/right enters an inset.

Fixes bug #10630.

(cherry picked from commit 2e84b8030e)
2017-06-15 10:31:14 +02:00
Jean-Marc Lasgouttes
c492f22593 Set cursor properly after double/triple click in mathed
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)
2017-06-15 10:21:18 +02:00
Jean-Marc Lasgouttes
8fef81a373 Avoid rounding issue when painting selection
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)
2017-06-12 14:47:32 +02:00
Jean-Marc Lasgouttes
04efc84abc Fix bad cursor positioning when entering an inset
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)
2017-06-12 13:57:46 +02:00
Richard Heck
42facddf55 Early updates to ANNOUNCE in preparation for 2.2.4. 2017-06-07 14:57:39 -04:00
Uwe Stöhr
8429a27494 ja.po: updates from Koji 2017-06-06 23:35:33 +02:00
Richard Heck
703da4ebe3 Remerge strings. 2017-06-06 16:42:11 -04:00
Enrico Forestieri
d738151a9b Fix bug #10685
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.
2017-06-06 00:01:14 +02:00
Enrico Forestieri
59c22bd7b6 Fix bugs #9598 and #10650 2017-06-05 23:14:48 +02:00
Enrico Forestieri
4945fabff1 Fix bug #10636
The code was not accounting for partial preview of the source code
and was trying to pop a language that was never pushed.
2017-06-05 22:59:25 +02:00
Richard Heck
1f8823bc9d Fix bug #10295.
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)
2017-06-04 18:32:33 -04:00
Scott Kostyshak
6cc1bdc1ad zh_CN.po: updates from Su Baochen 2017-06-03 15:12:55 -04:00
Jean-Marc Lasgouttes
04350ad288 Cache QTextLayout objects with Qt/Mac
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)
2017-06-01 10:54:28 +02:00
Jean-Marc Lasgouttes
413de12adf Take in account end of paragraph marker for inset width
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)
2017-05-30 11:59:35 +02:00
Richard Heck
f3fcf18e96 Revert unintended part of commit that was causing changed output. 2017-05-29 18:25:26 -04:00
Richard Heck
f92744d18d These two routines are now redundant.
(cherry picked from commit c19794a013)
2017-05-24 23:44:03 -04:00
Richard Heck
348c95d1bf We can now use the cached information instead of tracing the graph.
(cherry picked from commit 7c9e9b4c90)
2017-05-24 23:40:05 -04:00
Richard Heck
e9b14eed60 Use a typedef for vector<Format const *>, which is what gets used
for lists of exportable and importable formats.

(cherry picked from commit 014bc7805e)
2017-05-24 23:35:51 -04:00
Richard Heck
1cdbf23d69 Since we're now caching this, we can sort it once, rather than
lots of times.

(cherry picked from commit 7fd1a14c1b)
2017-05-24 23:30:09 -04:00
Richard Heck
2775295014 Simple cache for information on exportable formats, since we seem
to access this information a lot.

(cherry picked from commit 0b67e103e9)
2017-05-24 21:39:22 -04:00
Kornel Benko
d2b6520783 Update sk.po 2017-05-23 17:24:57 +02:00
Jean-Marc Lasgouttes
b82137ef18 Row::Element::x2pos: go to nearest point also over insets
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)
2017-05-23 11:02:06 +02:00
Jean-Marc Lasgouttes
ff97324621 Set boundary correctly in getPosNearX
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)
2017-05-23 10:59:24 +02:00
Jean-Marc Lasgouttes
bafc40b857 editXY: make cursor positionning correct over non editable inset
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)
2017-05-23 10:57:26 +02:00
Jean-Marc Lasgouttes
db9f41c039 Work around bug in QTextLine::xToCursor
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)
2017-05-23 10:50:08 +02:00