]> git.lyx.org Git - lyx.git/log
lyx.git
2 years ago#12157 Replace old with new banner in DMG background image
Stephan Witt [Mon, 10 Jan 2022 06:48:54 +0000 (07:48 +0100)]
#12157 Replace old with new banner in DMG background image

2 years ago#12423 fix a focus change problem
Stephan Witt [Sun, 9 Jan 2022 21:33:43 +0000 (22:33 +0100)]
#12423 fix a focus change problem

The search widget triggers a showEvent() in updateTitle() leading to setting the focus to the default push button.
The check in updateTitle() for the need to restore the title avoids superfluous show events and avoids the unwanted focus change.

2 years ago#12434 add GUI debug messages for pinch-to-zoom gesture
Stephan Witt [Sun, 9 Jan 2022 11:29:02 +0000 (12:29 +0100)]
#12434 add GUI debug messages for pinch-to-zoom gesture

2 years agoPinch to zoom fix
Daniel Ramoeller [Wed, 5 Jan 2022 14:27:46 +0000 (15:27 +0100)]
Pinch to zoom fix

Amendment to fix for #12434.

2 years agofix file name
Jean-Marc Lasgouttes [Sat, 8 Jan 2022 22:03:15 +0000 (23:03 +0100)]
fix file name

2 years agoDocument \draw_strategy in release notes
Jean-Marc Lasgouttes [Fri, 7 Jan 2022 16:58:33 +0000 (17:58 +0100)]
Document \draw_strategy in release notes

Also trim some whitespace.

2 years ago#12451 Adjust color cache on change of dark/light mode
Stephan Witt [Wed, 5 Jan 2022 07:26:18 +0000 (08:26 +0100)]
#12451 Adjust color cache on change of dark/light mode

2 years agoSet current cursor font when toggling emphasize
Jean-Marc Lasgouttes [Tue, 4 Jan 2022 17:58:55 +0000 (18:58 +0100)]
Set current cursor font when toggling emphasize

The change actually works for all font toggling with implicit selection.

Fixes bug #12450.

2 years agoAdd new placeholder $${python} to configure
José Matos [Tue, 4 Jan 2022 00:21:34 +0000 (00:21 +0000)]
Add new placeholder $${python} to configure

This ensures that we use a consistent Python interpreter in LyX.

$${python} is replaced by the Python version found.

Users can apply this in preferences and use the same version defined by
LyX.

2 years agoChange LFUN arg from "zoom" to "zoomlevel"
Scott Kostyshak [Mon, 3 Jan 2022 20:53:56 +0000 (15:53 -0500)]
Change LFUN arg from "zoom" to "zoomlevel"

This change is just to be more specific, to help when grepping and
reading.

The idea is from Daniel
(https://www.lyx.org/trac/ticket/12420?replyto=11#comment:11).

Amends cc787967 (and thus 49a17aaa).

2 years agoMake layout2layout compatible with Python 2 and 3
José Matos [Mon, 3 Jan 2022 19:59:42 +0000 (19:59 +0000)]
Make layout2layout compatible with Python 2 and 3

2 years agoRemove temporary code comment.
Stephan Witt [Mon, 3 Jan 2022 09:44:02 +0000 (10:44 +0100)]
Remove temporary code comment.

2 years ago#12434 add event handler for pinch-to-zoom gesture
Stephan Witt [Mon, 3 Jan 2022 06:37:03 +0000 (07:37 +0100)]
#12434 add event handler for pinch-to-zoom gesture

2 years agoFix bug #12447
Enrico Forestieri [Sun, 2 Jan 2022 17:49:44 +0000 (18:49 +0100)]
Fix bug #12447

Due to a thinko at 1fe75ae7 the code was not using the correct index.

2 years agoGuard new code for builds with OS X 10.11 SDK and lesser (part 2).
Stephan Witt [Sat, 1 Jan 2022 17:47:57 +0000 (18:47 +0100)]
Guard new code for builds with OS X 10.11 SDK and lesser (part 2).

2 years agoGuard new code for builds with OS X 10.11 SDK and lesser.
Stephan Witt [Sat, 1 Jan 2022 17:46:32 +0000 (18:46 +0100)]
Guard new code for builds with OS X 10.11 SDK and lesser.

2 years agoCorrect white space.
Stephan Witt [Sat, 1 Jan 2022 15:37:07 +0000 (16:37 +0100)]
Correct white space.

2 years agoQt6 QFontDatabase is a pure static class. Call the member functions directly.
Stephan Witt [Sat, 1 Jan 2022 09:06:07 +0000 (10:06 +0100)]
Qt6 QFontDatabase is a pure static class. Call the member functions directly.

2 years agoGuiGraphics: disable "Read from file" button if the values do not differ
Juergen Spitzmueller [Fri, 31 Dec 2021 13:32:59 +0000 (14:32 +0100)]
GuiGraphics: disable "Read from file" button if the values do not differ

2 years agoGuiGraphics: check more carefully whether we have a changed BB
Juergen Spitzmueller [Fri, 31 Dec 2021 13:32:13 +0000 (14:32 +0100)]
GuiGraphics: check more carefully whether we have a changed BB

2 years agoGuiGraphics: read the BB values also for new graphics
Juergen Spitzmueller [Fri, 31 Dec 2021 13:30:09 +0000 (14:30 +0100)]
GuiGraphics: read the BB values also for new graphics

that aren't in the cache yet.

2 years agoFix font inside footnote inset
Jean-Marc Lasgouttes [Fri, 3 Dec 2021 11:16:40 +0000 (12:16 +0100)]
Fix font inside footnote inset

An inset that resets its font (like Footnote) does not care at all
about enclosing font. Therefore the real starting point is the class
default font. This avoid cases where the footnote contents is forced
to \normalsize.

It turns out that the Greyedout note inset, did inherit font but was
declared as not doing it. This commmit changes the definition by
adding \normalfont\normalsize so that no inheritance happens.

Note that actually \normalfont resets everything but the font size.
This does not matter for footnote (which has its own font size) and
greyedout (which is fixed now), but may matter elsewhere. Also, I do
not know what the situation with HTML is.

2 years agoReduce the mix of python versions in configure.py in case of running it with python3
Stephan Witt [Fri, 31 Dec 2021 12:40:22 +0000 (13:40 +0100)]
Reduce the mix of python versions in configure.py in case of running it with python3

2 years agoAvoid python based lilypond-book detection if it's not needed - e.g. on Mac
Stephan Witt [Fri, 31 Dec 2021 10:54:14 +0000 (11:54 +0100)]
Avoid python based lilypond-book detection if it's not needed - e.g. on Mac

2 years agoAdd comment regarding fsanitize + Clang issue
Scott Kostyshak [Thu, 30 Dec 2021 16:37:12 +0000 (11:37 -0500)]
Add comment regarding fsanitize + Clang issue

We could not figure out the root issue, or at least not to the point
where we felt changing this code considering we could not trigger
any bug from a user perspective.

For now, we just add a comment in the code.

For more information, see our ML discussion here:

  https://www.mail-archive.com/search?l=mid&q=20211227113249.53bf5a63%40admin1-desktop

2 years agoUpdate sk.po
Kornel Benko [Wed, 29 Dec 2021 18:14:41 +0000 (19:14 +0100)]
Update sk.po

2 years agode.po
Juergen Spitzmueller [Wed, 29 Dec 2021 17:00:45 +0000 (18:00 +0100)]
de.po

2 years agoChange "Show Zoom Value" to "Show Zoom Level"
Scott Kostyshak [Wed, 29 Dec 2021 16:45:01 +0000 (11:45 -0500)]
Change "Show Zoom Value" to "Show Zoom Level"

See discussion at #12420.

Amends 49a17aaa.

2 years agoReg tests for language switching
Scott Kostyshak [Wed, 29 Dec 2021 15:17:53 +0000 (10:17 -0500)]
Reg tests for language switching

Use cases from #12352. The files correspond to
mwe-remove-bottom.23.lyx and mwe-remove-top.23.lyx. The only
differences are that I changed to FreeSans and FreeSerif for the
fonts.

2 years agoFix language environment with environments at inset begin/end (#12352)
Juergen Spitzmueller [Wed, 29 Dec 2021 15:07:40 +0000 (16:07 +0100)]
Fix language environment with environments at inset begin/end (#12352)

2 years agoRemove unused local variable
Stephan Witt [Wed, 29 Dec 2021 14:32:59 +0000 (15:32 +0100)]
Remove unused local variable

2 years agoFix TOC filtering with slashes (#12359)
Juergen Spitzmueller [Wed, 29 Dec 2021 13:43:52 +0000 (14:43 +0100)]
Fix TOC filtering with slashes (#12359)

Seems the * wildcard does not match these.

2 years agoUse Noto Sans Tibetan rather than Serif
Juergen Spitzmueller [Wed, 29 Dec 2021 12:44:40 +0000 (13:44 +0100)]
Use Noto Sans Tibetan rather than Serif

The sans is more complete and also seems to be more widely distributed.

2 years agoWhen row if empty, set endpos correctly.
Jean-Marc Lasgouttes [Tue, 28 Dec 2021 17:48:55 +0000 (18:48 +0100)]
When row if empty, set endpos correctly.

2 years agoUpdate sk.po
Kornel Benko [Tue, 28 Dec 2021 16:35:18 +0000 (17:35 +0100)]
Update sk.po

2 years agoStyle
Juergen Spitzmueller [Tue, 28 Dec 2021 08:42:31 +0000 (09:42 +0100)]
Style

2 years agoStyle
Juergen Spitzmueller [Tue, 28 Dec 2021 08:42:31 +0000 (09:42 +0100)]
Style

2 years agoAllow toggling of Zoom elements without buffer
Scott Kostyshak [Mon, 27 Dec 2021 18:40:56 +0000 (13:40 -0500)]
Allow toggling of Zoom elements without buffer

The elements are shown without a buffer so it's nice to be able to
toggle without one as well.

2 years agoChange label "Show Zoom" to "Show Zoom Value"
Scott Kostyshak [Mon, 27 Dec 2021 18:40:13 +0000 (13:40 -0500)]
Change label "Show Zoom" to "Show Zoom Value"

2 years agoHide the zoom in the status bar from the status bar context menu
Daniel Ramoeller [Tue, 2 Nov 2021 08:12:03 +0000 (09:12 +0100)]
Hide the zoom in the status bar from the status bar context menu

Fix for #12420.

2 years agoTypo
Jean-Marc Lasgouttes [Mon, 27 Dec 2021 18:38:10 +0000 (19:38 +0100)]
Typo

2 years agoctests: uninvert a DocBook export
Scott Kostyshak [Mon, 27 Dec 2021 16:17:29 +0000 (11:17 -0500)]
ctests: uninvert a DocBook export

The export now succeeds, likely due to Jürgen's improvements at
2eaf30c5.

2 years agoInvert two DocBook + LilyPond exports
Scott Kostyshak [Mon, 27 Dec 2021 16:09:21 +0000 (11:09 -0500)]
Invert two DocBook + LilyPond exports

This is due to an upstream issue:

  https://gitlab.com/lilypond/lilypond/-/issues/6187

For ML discussion, see here:

  https://www.mail-archive.com/search?l=mid&q=20211102011304.dmrcr7gjpxxwpd4o%40poole

2 years agoDo not protect \\ as of LaTeX 2021/06/01
Juergen Spitzmueller [Mon, 27 Dec 2021 15:31:09 +0000 (16:31 +0100)]
Do not protect \\ as of LaTeX 2021/06/01

2 years agoReg test for protect: xymatrix in figure caption
Scott Kostyshak [Mon, 27 Dec 2021 15:26:04 +0000 (10:26 -0500)]
Reg test for protect: xymatrix in figure caption

Use case from #6243.

2 years agoAdd FIXME
Juergen Spitzmueller [Mon, 27 Dec 2021 11:09:02 +0000 (12:09 +0100)]
Add FIXME

2 years agoRemove remaining math cprotection test.
Juergen Spitzmueller [Mon, 27 Dec 2021 10:52:25 +0000 (11:52 +0100)]
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

2 years ago\protect xymatrix in fragile context
Juergen Spitzmueller [Mon, 27 Dec 2021 10:42:30 +0000 (11:42 +0100)]
\protect xymatrix in fragile context

(\cprotect'ion not needed then).

2 years ago\protect substack in fragile context
Juergen Spitzmueller [Mon, 27 Dec 2021 10:37:59 +0000 (11:37 +0100)]
\protect substack in fragile context

(\cprotect'ion not needed then).

2 years agoRemove obsolete \cprotect'ion (#6243)
Juergen Spitzmueller [Mon, 27 Dec 2021 09:24:58 +0000 (10:24 +0100)]
Remove obsolete \cprotect'ion (#6243)

2 years agoWhen pasting text, keep line breaks when "parbreak is newline"
Jean-Marc Lasgouttes [Thu, 18 Nov 2021 15:36:29 +0000 (16:36 +0100)]
When pasting text, keep line breaks when "parbreak is newline"

This is much easier for listings, ERT or Verbatim.

Fixes bug #8026.

2 years agoDocBook: more explicit comment.
Thibaut Cuvelier [Sun, 26 Dec 2021 01:26:50 +0000 (02:26 +0100)]
DocBook: more explicit comment.

2 years agoDocBook: update basic.xml for the latest MathML and DocBook changes.
Thibaut Cuvelier [Sun, 26 Dec 2021 01:24:23 +0000 (02:24 +0100)]
DocBook: update basic.xml for the latest MathML and DocBook changes.

2 years agoAmend c734504d to fix a very bad nullptr dereferencing...
Thibaut Cuvelier [Sun, 26 Dec 2021 01:24:06 +0000 (02:24 +0100)]
Amend c734504d to fix a very bad nullptr dereferencing...

2 years agoRemove code that has been commented out for a long time.
Thibaut Cuvelier [Sun, 26 Dec 2021 01:14:34 +0000 (02:14 +0100)]
Remove code that has been commented out for a long time.

2 years agoctests: invert a docbook test for a cprotect case
Scott Kostyshak [Fri, 24 Dec 2021 02:24:28 +0000 (21:24 -0500)]
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

2 years agoDocBook: in InsetFloat, detect the presence of a caption by generating it.
Thibaut Cuvelier [Fri, 24 Dec 2021 00:08:24 +0000 (01:08 +0100)]
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.

2 years agoReg test for cprotect: float in par environment
Scott Kostyshak [Thu, 23 Dec 2021 20:10:26 +0000 (15:10 -0500)]
Reg test for cprotect: float in par environment

File from #7779.

2 years agoReg test for cprotect: comment in figure caption
Scott Kostyshak [Thu, 23 Dec 2021 03:45:39 +0000 (22:45 -0500)]
Reg test for cprotect: comment in figure caption

File from #9313.

2 years agoRegression test for cprotect, #7116
Scott Kostyshak [Thu, 23 Dec 2021 02:58:56 +0000 (21:58 -0500)]
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.

2 years agoFindAdv: Added handling of some missing Hebrew characters
Kornel Benko [Tue, 21 Dec 2021 13:16:49 +0000 (14:16 +0100)]
FindAdv: Added handling of some missing Hebrew characters

2 years agoDo not repeatedly call main_font_encoding()
Juergen Spitzmueller [Mon, 20 Dec 2021 11:09:12 +0000 (12:09 +0100)]
Do not repeatedly call main_font_encoding()

This method impacts on performance and we store the value anyway in
the output params.

2 years agoParagraph::needsCProtection(): use inset list
Juergen Spitzmueller [Sun, 19 Dec 2021 14:39:49 +0000 (15:39 +0100)]
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).

2 years agoAdd UI for selecting backing store drawing strategy
Jean-Marc Lasgouttes [Fri, 17 Dec 2021 10:12:54 +0000 (11:12 +0100)]
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.

2 years agoAdd lyxrc option to force the use of backing store
Jean-Marc Lasgouttes [Thu, 16 Dec 2021 11:38:19 +0000 (12:38 +0100)]
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

2 years agoAmend bea7ef04e (find's auto-wrap by default)
Scott Kostyshak [Thu, 16 Dec 2021 01:48:20 +0000 (20:48 -0500)]
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.

2 years agoAvoid duplication of words on screen
Jean-Marc Lasgouttes [Wed, 15 Dec 2021 10:19:18 +0000 (11:19 +0100)]
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.

2 years agoImproved Qt framework configuration detection on macOS, add QtCore5Compat headers...
Stephan Witt [Sun, 12 Dec 2021 21:24:23 +0000 (22:24 +0100)]
Improved Qt framework configuration detection on macOS, add QtCore5Compat headers to configure based includes

2 years agoFix an overloaded-virtual warning for type mismatch of event parameter (Qt6)
Stephan Witt [Thu, 9 Dec 2021 20:58:14 +0000 (21:58 +0100)]
Fix an overloaded-virtual warning for type mismatch of event parameter (Qt6)

2 years agolanguages test file: Use new Tibetan font name
Scott Kostyshak [Thu, 9 Dec 2021 20:16:07 +0000 (15:16 -0500)]
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.

2 years agoFix endless loop when breaking text
Jean-Marc Lasgouttes [Thu, 9 Dec 2021 15:43:16 +0000 (16:43 +0100)]
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.

2 years agoctests: log a fixed issue (fr Linguistics.lyx)
Scott Kostyshak [Thu, 9 Dec 2021 04:03:43 +0000 (23:03 -0500)]
ctests: log a fixed issue (fr Linguistics.lyx)

2 years agofr/Linguistics.lyx: fixes
Juergen Spitzmueller [Wed, 8 Dec 2021 08:49:23 +0000 (09:49 +0100)]
fr/Linguistics.lyx: fixes

* Fix up markup in and localize examples
* Remove local layout from lyx2lyx conversion

2 years agoMathML: remove redundant mrow in InsetMathScript.
Thibaut Cuvelier [Wed, 8 Dec 2021 01:11:48 +0000 (02:11 +0100)]
MathML: remove redundant mrow in InsetMathScript.

https://www.lyx.org/trac/attachment/ticket/12221/0006-amends-to-a579128c-a68e9793-a68e9793.patch by lynx

2 years agoMathML: share some code for XArrow.
Thibaut Cuvelier [Wed, 8 Dec 2021 01:02:39 +0000 (02:02 +0100)]
MathML: share some code for XArrow.

2 years agoMathML: refactor the XArrow mappings as maps.
Thibaut Cuvelier [Wed, 8 Dec 2021 00:53:56 +0000 (01:53 +0100)]
MathML: refactor the XArrow mappings as maps.

2 years agoMathML: allow XArrow to stretch.
Thibaut Cuvelier [Wed, 8 Dec 2021 00:36:24 +0000 (01:36 +0100)]
MathML: allow XArrow to stretch.

Based on https://www.lyx.org/trac/ticket/12221#comment:10
by lynx

2 years agosymbols: update HTML entities and Unicode encodings for Greek letter variations.
Thibaut Cuvelier [Mon, 6 Dec 2021 21:35:26 +0000 (22:35 +0100)]
symbols: update HTML entities and Unicode encodings for Greek letter variations.

2 years agosymbols: don't encode vertical bars as nonexistent HTML entities.
Thibaut Cuvelier [Mon, 6 Dec 2021 21:19:36 +0000 (22:19 +0100)]
symbols: don't encode vertical bars as nonexistent HTML entities.

Excerpt from https://www.lyx.org/trac/ticket/12221#comment:11

Created by lynx

2 years agoRestore correct version check for AA_UseHighDpiPixmaps - amend change ae56fb6171
Stephan Witt [Tue, 7 Dec 2021 22:01:47 +0000 (23:01 +0100)]
Restore correct version check for AA_UseHighDpiPixmaps - amend change ae56fb6171

2 years agoctests: uninvert Seminar tests
Scott Kostyshak [Tue, 7 Dec 2021 18:25:39 +0000 (13:25 -0500)]
ctests: uninvert Seminar tests

These exports now succeed on an updated TL21 installation.

2 years agoctests: log fixed upstream polyglossia issues
Scott Kostyshak [Tue, 7 Dec 2021 18:03:39 +0000 (13:03 -0500)]
ctests: log fixed upstream polyglossia issues

Thanks to Jürgen for fixing these upstream Polyglossia regressions.

2 years agoFix the way the top and bottom selection are drawn
Jean-Marc Lasgouttes [Tue, 7 Dec 2021 17:15:01 +0000 (18:15 +0100)]
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.

2 years agoMerge branch 'breakrows'
Jean-Marc Lasgouttes [Tue, 7 Dec 2021 16:06:21 +0000 (17:06 +0100)]
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.

2 years agoOne less thing to do in PAINTING_ANALYSIS
Jean-Marc Lasgouttes [Tue, 12 Oct 2021 09:33:23 +0000 (11:33 +0200)]
One less thing to do in PAINTING_ANALYSIS

2 years agoIncrease metrics cache maximal size
Jean-Marc Lasgouttes [Tue, 5 Oct 2021 13:52:31 +0000 (15:52 +0200)]
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.

2 years agoImprove row flushing
Jean-Marc Lasgouttes [Wed, 22 Sep 2021 13:09:26 +0000 (15:09 +0200)]
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).

2 years agoSimplify setting of RTL in rows
Jean-Marc Lasgouttes [Wed, 22 Sep 2021 11:17:46 +0000 (13:17 +0200)]
Simplify setting of RTL in rows

Set RTL status at row creation, which allows to remove a parameter from
cleanupRow.

2 years agoBreak multi-row strings in one pass
Jean-Marc Lasgouttes [Mon, 6 Sep 2021 12:52:42 +0000 (14:52 +0200)]
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.

2 years agoAdd operator<< for Row::Elements
Jean-Marc Lasgouttes [Mon, 20 Sep 2021 15:32:18 +0000 (17:32 +0200)]
Add operator<< for Row::Elements

This is useful for debugging.

2 years agoFix setting of row pos/endpos (overlapping rows)
Jean-Marc Lasgouttes [Thu, 2 Sep 2021 13:16:28 +0000 (15:16 +0200)]
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.

2 years agoGet rid of need_new_row boolean in breakParagraph
Jean-Marc Lasgouttes [Wed, 1 Sep 2021 14:54:28 +0000 (16:54 +0200)]
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.

2 years agoCentralize the code that removes trailing spaces from end row element.
Jean-Marc Lasgouttes [Tue, 31 Aug 2021 17:23:55 +0000 (19:23 +0200)]
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.

2 years agoHandle the case where breakAt cuts after trailing space
Jean-Marc Lasgouttes [Tue, 31 Aug 2021 13:58:56 +0000 (15:58 +0200)]
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.

2 years agoWorkaround for Qt 4
Jean-Marc Lasgouttes [Mon, 30 Aug 2021 13:48:44 +0000 (15:48 +0200)]
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.

2 years agoLast step of transition: use sortenIfNeeded again.
Jean-Marc Lasgouttes [Mon, 19 Jul 2021 22:07:13 +0000 (00:07 +0200)]
Last step of transition: use sortenIfNeeded again.

Change semantics of Row::shortenIfNeeded: instead of breaking the row
and returning a boolean, it returns the list of row elements that have
been removed (or broken) from the row. The logic of the method remains
the same.

Use shortenIfNeeded in breakParagraph. This was the last missing block.

Remove Row::breakAt and the old breakRow. Only bugs remain now :)

2 years agoImplement handling of row_flags for row breaking
Jean-Marc Lasgouttes [Sat, 17 Jul 2021 23:09:33 +0000 (01:09 +0200)]
Implement handling of row_flags for row breaking

To this end, add the helper function needsRowBreak which computes the
effect of two consecutive row flags. This function implements the
priorities described in RowFlags.h.

This function is called with the relevant flags, or NoBreak* when at
boundaries and updates need_new_row.

Some common code is factored in a new cleanupRow() helper.

2 years agoChange the way the element's width is updated.
Jean-Marc Lasgouttes [Sat, 17 Jul 2021 21:16:15 +0000 (23:16 +0200)]
Change the way the element's width is updated.

Remove the code that computed the width every 30 characters (yay!).
Make sure that finalizeLast() is called after inserting a row element in
a row in breakParagraph.

2 years agoIntroduce helper template to simplify breakParagraph code
Jean-Marc Lasgouttes [Sat, 17 Jul 2021 00:31:49 +0000 (02:31 +0200)]
Introduce helper template to simplify breakParagraph code

This is a semi-generic iterator for iterating over a container and
pretend that we add elements to it along the way.

2 years agoA set of easy fixes and missing features
Jean-Marc Lasgouttes [Thu, 15 Jul 2021 22:10:25 +0000 (00:10 +0200)]
A set of easy fixes and missing features

* show changebar when end of paragraph is changed.

* when row is finished, set endpos and right_boundary

* handle bidi.