Commit Graph

23329 Commits

Author SHA1 Message Date
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
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
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
Enrico Forestieri
05d4332152 Fix bug #10469 2017-05-20 02:36:16 +02:00
Uwe Stöhr
7b0f63f67b Color.cpp: backport fix for bug #10656 2017-05-16 23:47:35 +02:00
Uwe Stöhr
e40205e749 InsetFloat.cpp: backport fix for bug #10618 2017-05-16 23:44:32 +02:00
Juergen Spitzmueller
0887f89350 Do not add symbols twice to Encoding::symbolsList()
Also sort the list properly.

Fixes #10644
2017-05-16 13:37:29 +02:00
Uwe Stöhr
826b704b31 backport fix for bug #10440
thanks Enrico!
2017-04-20 22:20:50 +02:00
Uwe Stöhr
0271602b8d - backport fix for bug #10466
Handle the command \multicolumn correctly in math macros
2017-04-18 23:53:27 +02:00
Uwe Stöhr
a526ff58c1 GuiDialog.cpp: remove question marks from Windows dialogs
backported from master, fixes bug #10098, patch from Guillaume
2017-04-04 23:54:31 +02:00
Enrico Forestieri
caf56220c6 Fix bug #10554
The \lyxdeleted macro cannot cope with \newpage & co.
2017-04-03 00:07:53 +02:00
Enrico Forestieri
9450cf7b12 Fix #9732: Inconsistent font properties for the preview and superscript insets
(cherry picked from commit b6f8a84a35)
2017-03-29 18:25:27 -04:00
Enrico Forestieri
6836c75803 Fix bug #10579
The \lyxdeleted macro cannot cope with empty lines.

(cherry picked from commit 5940dc53aa)
2017-03-28 14:59:58 -04:00
Juergen Spitzmueller
0312d30f9c Consider text-mode accents of the form {\v a} in BiblioInfo
Fixes #9340.
2017-03-19 16:53:12 +01:00
Jean-Marc Lasgouttes
7808a20e5c Fix crash when adding newline at the end of a paragraph
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.
2017-03-11 20:23:22 +01:00
Enrico Forestieri
2b9965aebb Allow Input of local includes from local layout files
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)
2017-03-01 14:55:00 -05:00
Guillaume Munch
9f2fcf20a5 Fix compilation with Qt5.8dev
(cherry picked from commit 6d375ddeac)
2017-02-26 00:13:23 +01:00
Enrico Forestieri
857548d33b Allow inserting consecutive dashes
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.
2017-02-25 21:00:25 +01:00
Guillaume Munch
998c3e7c8e Introduce support/Cache.h
Useful to cache copies of objects, including shared_ptrs. No risks of dangling
pointer, and avoid naked pointers in the source.

Fix memory leak when compiling with Qt5.

As part as the backport to stable, this code has been change to work
with C++98.

(cherry picked from commit 33b696c8ac)
(cherry picked from commit e04079aa52)
(cherry picked from commit 5211ca52ca)
(cherry picked from commit 8353a53cc3)
2017-02-23 18:07:30 +01:00
Juergen Spitzmueller
508f4deae2 Output Preamble code of InPreamble styles before the styles themselves.
This assures that macros are defined.

Fixes: #10215
2017-02-23 10:53:30 +01:00
Jean-Marc Lasgouttes
e76a0fb8d8 Fix crash when selecting muticolumn in math
The cells that are part of the multicolumn are not in the cache, and
it is OK.

Fixes bug #10486.
2017-02-23 10:51:12 +01:00
Juergen Spitzmueller
39cee7396b Use localized item when calculating the panel stack's tree widget width.
The current version was wrong for non-English dialogs, and even for
the English one, due to the translator commands that were not removed
for calculation (as in "Formats[[output]]").
2017-02-07 07:56:44 +01:00
Juergen Spitzmueller
8a0696db29 Correctly enable/disable citation dialog widgets on initialization.
Thanks Guillaume for pointing this out.
2017-02-06 18:24:51 +01:00
Jean-Marc Lasgouttes
1438123a13 Fix flushing of row that was cut after an hyphen
When using Qt stuff in breakAt, it may happen that the row is broken
after an hyphen (whereas the old code would only consider spaces).

The fact that we abuse the Row::right_boundary() property to detect when
a row should be flushed broke justification when a row is cut at an
hyphen.

Fix this by introducing a new Row::flushed() property and set it as needed.
(cherry picked from commit 8e7d0c2002)
2017-02-06 10:39:38 +01:00
Jean-Marc Lasgouttes
b0673bd1fa Fix wrong splitting of text row
The code that tries to decide whether it is worth splitting a given
text row element had a shortcoming: it did not take into account the
left margin of the new row that would be created.

The problem is that this left margin is not the same as the left
margin of the current row, because there can be for example
indentation effects.

To fix this problem, we pass the amount of available space on the
next row as a parameter of Row::shortenIfNeeded.

Note that there is no need to care about RtL row elements at this
point, since the bidi algorithm will be applied to the row
subsequently.
(cherry picked from commit 8491962c6b)
2017-02-06 10:37:12 +01:00
Jean-Marc Lasgouttes
ddac5a7f59 Compilation fix in C++98 mode. 2017-02-06 10:28:47 +01:00
Jean-Marc Lasgouttes
59577dea7a Handle properly unicode paragraph/line break
They are shown on screen by arrow or pilcrow symbol and cause a line break.

They are still not handled in LaTeX output, though.
(cherry picked from commit 6dfbab3124)
2017-02-06 10:28:22 +01:00
Jean-Marc Lasgouttes
90688b63be Make sanitize more robust to dangling pointers.
It is necessary to sanitize the new_word iterator too.
(cherry picked from commit 344f7f2e7d)
2017-02-02 13:57:12 +01:00
Juergen Spitzmueller
a50ad8f926 Handle backslash in escape function.
Fixes: #4595.

Candidate for stable
2017-01-28 09:27:45 +01:00
Juergen Spitzmueller
efca146571 Generalize the protection of brackets in citation arguments
Whenever an argument delimiter is used inside the argument, the argument
needs to be grouped, that is

\cites({text (text) text})

or

\cite[{text [text] text}]

This fixes the original case reported in #2751 which is independent
from the general issue that the pre- and postnote field take literal
code.
2017-01-26 18:32:26 +01:00
Guillaume Munch
2305fd838c Fix compilation with --disable-cxx11 2017-01-26 01:10:39 +01:00
Jean-Marc Lasgouttes
81465da5d5 Fix metrics of math characters with 0 width
It seems that QTextLayout does not handle properly a single character
with 0 width. This breaks drawing of things like \not.

No status line needed as this amends 24648404.
2017-01-21 00:30:20 +01:00
Richard Heck
239be02234 Allow LyX to open empty files (created, e.g., via "touch").
Patch from new contributor Jan Niklas Hasse.

(cherry picked from commit 0d77a7e325)
2017-01-19 15:37:08 -05:00
Juergen Spitzmueller
6a0de80b6b We don't have formatToolTip in stable. Use wrap instead.
Sorry for the hassle.
2017-01-13 11:32:36 +01:00
Juergen Spitzmueller
ca9c8dbde1 Assure long tooltip is correctly formatted.
Amendment to ffb195b5e9
2017-01-13 09:09:43 +01:00
Juergen Spitzmueller
8184156f8f Clarify layout and add some tooltips
Addresses: #9795
2017-01-12 09:06:26 +01:00
Enrico Forestieri
a9dd6ea6bc Avoid useless warning from Qt
When cloning InsetExternal, the tempname_ member of InsetExternalParams
has yet to be initialized. So, trying to remove it causes the warning
"QFile::remove: Empty or null file name".

(cherry picked from commit 25e6b5da39)
2017-01-08 18:48:55 -05:00