Commit Graph

44152 Commits

Author SHA1 Message Date
Juergen Spitzmueller
6ac60832e5 Add FIXME 2021-12-27 12:09:02 +01:00
Juergen Spitzmueller
a5b7eeacaa Remove remaining math cprotection test.
We'll see if someone comes up with a reproducible case, and if so,
whether ordinary protection works here as well.

See #6243
2021-12-27 11:52:25 +01:00
Juergen Spitzmueller
582fe0990f \protect xymatrix in fragile context
(\cprotect'ion not needed then).
2021-12-27 11:42:30 +01:00
Juergen Spitzmueller
596b2d16ee \protect substack in fragile context
(\cprotect'ion not needed then).
2021-12-27 11:37:59 +01:00
Juergen Spitzmueller
3e4c831f1e Remove obsolete \cprotect'ion (#6243) 2021-12-27 10:24:58 +01:00
Jean-Marc Lasgouttes
542445d07d When pasting text, keep line breaks when "parbreak is newline"
This is much easier for listings, ERT or Verbatim.

Fixes bug #8026.
2021-12-26 20:22:01 +01:00
Thibaut Cuvelier
51e92a5a97 DocBook: more explicit comment. 2021-12-26 02:26:50 +01:00
Thibaut Cuvelier
db1a443a70 DocBook: update basic.xml for the latest MathML and DocBook changes. 2021-12-26 02:24:23 +01:00
Thibaut Cuvelier
4c27a7307e Amend c734504d to fix a very bad nullptr dereferencing... 2021-12-26 02:24:06 +01:00
Thibaut Cuvelier
81274c8da7 Remove code that has been commented out for a long time. 2021-12-26 02:14:49 +01:00
Scott Kostyshak
9d64a2f2f6 ctests: invert a docbook test for a cprotect case
The strange example file does not make sense for Docbook, as
described by Thibaut on the ML here:

  https://www.mail-archive.com/search?l=mid&q=CAK0LPyiHCsUMo0ZCbFrRBRTCD7G-rhw-z8G1of2kFGebBLddtA%40mail.gmail.com
2021-12-23 21:37:31 -05:00
Thibaut Cuvelier
c734504d3b DocBook: in InsetFloat, detect the presence of a caption by generating it.
This catches the case where the caption only contains a comment, as in export/export/latex/lyxbugs-resolved/cprotect/9313-comment-in-figure-float-caption. No duplicate work is performed to ensure the same level of performance as before.
2021-12-24 01:08:24 +01:00
Scott Kostyshak
e056cab792 Reg test for cprotect: float in par environment
File from #7779.
2021-12-23 15:11:05 -05:00
Scott Kostyshak
4b8bb00573 Reg test for cprotect: comment in figure caption
File from #9313.
2021-12-22 22:45:39 -05:00
Scott Kostyshak
87bea67863 Regression test for cprotect, #7116
Start a new directory of cprotect tests. There are many situations
where cprotect is needed so we can add files covering various
situations as we find them.

This particular test covers the case of special characters in URL
insets in footnotes.
2021-12-22 22:03:02 -05:00
Kornel Benko
942121f4b6 FindAdv: Added handling of some missing Hebrew characters 2021-12-21 14:16:49 +01:00
Juergen Spitzmueller
c2f2ba57f1 Do not repeatedly call main_font_encoding()
This method impacts on performance and we store the value anyway in
the output params.
2021-12-20 12:09:12 +01:00
Juergen Spitzmueller
61b8afd893 Paragraph::needsCProtection(): use inset list
rather than checking each pos whether it's an inset or not.

This was a significant performance bottleneck (particularly getInset()
itself seems slow).
2021-12-19 15:39:49 +01:00
Jean-Marc Lasgouttes
a3fd3a09f1 Add UI for selecting backing store drawing strategy
The checkbox is hidden when backing store is enforced (wayland,
macOS). In practice, only X11 and Windows users will see it ; I only
have evidence of X11 people needing it, I can hide it for Windows
users too if necessary.

Fixes bug #12119.
2021-12-17 15:16:35 +01:00
Jean-Marc Lasgouttes
c213eb7f75 Add lyxrc option to force the use of backing store
LyX relies on a a backing store to draw when running under macOS or
Wayland, because Qt arbitrarily overwrites parts of the workarea
before we paint (and we paint only the parts that need to be painted).
However it seems that this is also necessary on X11 when the WM theme
is translucid. Since there is no way that I know of to detect this
situation, this patch adds a LyXRC setting to manually select this
drawing strategy.

Note that using a backing store is not always a good solution, since
this disables subpixel aliasing.

At this point there is no UI for the variable.

Fixes bug #12119
2021-12-17 10:38:28 +01:00
Scott Kostyshak
056ab33f48 Amend bea7ef04e (find's auto-wrap by default)
The default in the .ui is not considered in
GuiSearchWidget::restoreSession(), which sets a hard-coded default
if the stored setting is not found in the session file.

I'll start an ML discussion for whether the code in restoreSession()
should use the ui's default if the setting is not found in the
session.
2021-12-15 20:51:50 -05:00
Jean-Marc Lasgouttes
62ad205dbf Avoid duplication of words on screen
When giving up splitting a word sequence because it is not enough to
make the row short enough, make sure to clean up properly.
2021-12-15 11:19:18 +01:00
Stephan Witt
cb4715d739 Improved Qt framework configuration detection on macOS, add QtCore5Compat headers to configure based includes 2021-12-12 22:24:23 +01:00
Stephan Witt
4665baac46 Fix an overloaded-virtual warning for type mismatch of event parameter (Qt6) 2021-12-09 21:59:23 +01:00
Scott Kostyshak
80a901506b languages test file: Use new Tibetan font name
Noto Sans Tibetan was not actually a sans font. On newer systems the
font is now Noto Serif Tibetan.

See, e.g., the package 'fonts-noto-core' in Ubuntu 21.04.

This change also fixes compilation of
supported-languages_polyglossia-XeTeX.lyx on Ubuntu 21.10.
2021-12-09 15:17:14 -05:00
Jean-Marc Lasgouttes
dcef1a9cad Fix endless loop when breaking text
For some reason, Qt can break strings before the first character
(although we try to prevent that). The code was not prepared to that,
now it is.

Remove a forgotten debug statement.
2021-12-09 16:56:09 +01:00
Scott Kostyshak
b461d07b5b ctests: log a fixed issue (fr Linguistics.lyx) 2021-12-08 23:04:24 -05:00
Juergen Spitzmueller
2eaf30c57e fr/Linguistics.lyx: fixes
* Fix up markup in and localize examples
* Remove local layout from lyx2lyx conversion
2021-12-08 09:49:23 +01:00
Thibaut Cuvelier
7513d88350 MathML: remove redundant mrow in InsetMathScript.
https://www.lyx.org/trac/attachment/ticket/12221/0006-amends-to-a579128c-a68e9793-a68e9793.patch by lynx
2021-12-08 02:11:48 +01:00
Thibaut Cuvelier
d1daa092f6 MathML: share some code for XArrow. 2021-12-08 02:02:46 +01:00
Thibaut Cuvelier
e5eef14414 MathML: refactor the XArrow mappings as maps. 2021-12-08 02:02:46 +01:00
Thibaut Cuvelier
f0bf41f574 MathML: allow XArrow to stretch.
Based on https://www.lyx.org/trac/ticket/12221#comment:10
by lynx
2021-12-08 02:02:46 +01:00
Thibaut Cuvelier
68ff3436c9 symbols: update HTML entities and Unicode encodings for Greek letter variations. 2021-12-08 02:02:46 +01:00
Thibaut Cuvelier
5b62d43835 symbols: don't encode vertical bars as nonexistent HTML entities.
Excerpt from https://www.lyx.org/trac/ticket/12221#comment:11

Created by lynx
2021-12-08 02:02:46 +01:00
Stephan Witt
0e0b76a76e Restore correct version check for AA_UseHighDpiPixmaps - amend change ae56fb6171 2021-12-07 23:01:47 +01:00
Scott Kostyshak
fb4a485c19 ctests: uninvert Seminar tests
These exports now succeed on an updated TL21 installation.
2021-12-07 13:25:39 -05:00
Scott Kostyshak
2713ea5189 ctests: log fixed upstream polyglossia issues
Thanks to Jürgen for fixing these upstream Polyglossia regressions.
2021-12-07 13:05:52 -05:00
Jean-Marc Lasgouttes
2fd8b6fc2a Fix the way the top and bottom selection are drawn
When a selection extends on more than a row, the space between the two
rows should always be painted in full. Otherwise, with layouts like
Chapter, the "Chapter" label may seem selected in part.
2021-12-07 18:15:01 +01:00
Jean-Marc Lasgouttes
bf9b4a0836 Merge branch 'breakrows'
With this merge, the way paragraphs are typeset changes. Paragraphs
are first tolenized as row elements, and these elements are then
broken into separate rows as needed to fit the margins. This allows to
reduce the amount of metrics computation and make LyX much faster in
the case of large insets.

Moreover, the code relies more on RofFlags enum, which desribes how an
inset or a row element should be typset. This aspect will be extended
in the future.

Some user for whom performance is very bad (which I cannot reproduce
unfortunately) have reported a 4-fold speedup. In general cases, the
speedup will be less impressive but still noticeable.

Related to bugs #12297 and #5861.
2021-12-07 17:06:21 +01:00
Jean-Marc Lasgouttes
2f8ea7ba05 One less thing to do in PAINTING_ANALYSIS 2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
572b06d640 Increase metrics cache maximal size
Increase the maximal size of the breakString cache (to compute where
to break lines) from 512kB to 10MB. This has a big impact of cache
hits on large file like the example in #12297, which is now 99%. On
this example the time taken by breakString decreases from 33.5us to
2.4us.

The string width cache has been increased fro 512kB to 1MB, but this
does not make such a big difference.

Additionally, comments and variable names have been improved.

Related to bug #12297.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
5966d4fb8d Improve row flushing
Add new row flags Flush and FlushBefore to let insets indicate whether
they cause flushing of current row (eg. newline) or of previous row
(e.g. display insets).
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
a06f0e48ec Simplify setting of RTL in rows
Set RTL status at row creation, which allows to remove a parameter from
cleanupRow.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
d723b90344 Break multi-row strings in one pass
Replace FontMetrics::breakAt, which returned the next break point,
with FontMetrics::breakString, which returns a vector of break points.
To this end, an additional parameter gives the available width for
next rows.

Rename various variables and methods accordingly. Factor the code in
breakString_helper to be more manageable.

Adapt Row::Element::splitAt to return a bool on sucess and provide
remaining row elements in a vector. The width noted above has been
added as parameters.

Rename the helper function splitFrom to moveElements and rewrite the
code to be more efficient.

Remove type of row element INVALID, which is not needed anymore.

The code in TextMetrics::breakParagraph is now much simpler.

In Row::finalize, remove the code that computed inconditionnally the
current element size, and make sure that this width will be computed
in all code paths of Row::Element::splitAt.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
71c2e2fda6 Add operator<< for Row::Elements
This is useful for debugging.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
4b69f5efa7 Fix setting of row pos/endpos (overlapping rows)
In TextMetrics::breakParagraph, get rid of the fragile `pos' local
variable, which was not correctly updated. Rely on the endpos of the
last element in row instead.

Rewrite cleanupRow to rely on the endpos of last the row element to
set row endpos, instead of a `pos' parameter.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
4120635185 Get rid of need_new_row boolean in breakParagraph
Instead of having breakParagraph decide when breaking a row is
necessary, let Row::shortenIfNeeded set the row_flag of the last
element to request a row break. This was already done in splitAt.

This is in preparation of splitAt splitting in more than two elements.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
ef6dfe18c2 Centralize the code that removes trailing spaces from end row element.
Move to Row::Element::rtrim the code in Row::shortenIfNeeded that
removes trailing spaces from last element in row, so that it can be
called when actually breaking a row.

Fixes bug found by Kornel.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
6e6976fbc5 Handle the case where breakAt cuts after trailing space
In this case, the extra element returned should empty but valid. The
row flag BreakAfter is set to indicate that we have a break there
(this principle will be used more generally in a forthcoming commit).

To detect that we cut at the trailing space, it is necessary to rely
on the difference between QTextLine::horizontalAdvance() and
QTextLine::naturalTextWidth() when the flag
QTextOption::IncludeTrailingSpaces is used: the trailing space is
taken into account in the later, but not in the former.

Somme comments have been added to make code intent clearer.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
6bc50fea3a Workaround for Qt 4
At least with Qt 4.8.7 on Ubuntu 16.04, QTextLine::lineWidth() can
return a bogus value, at least with Courier font. One hypothesis is
that the invisible characters that we use in breakAt_helper are given
a non-null width.

Work around it, although the exact bug has not been pinpointed.
2021-12-07 17:04:47 +01:00