Commit Graph

28040 Commits

Author SHA1 Message Date
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
Jean-Marc Lasgouttes
d694701315 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 :)
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
0ea1807a52 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.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
890fcc0872 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.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
49115315ea 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.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
df688126ca 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.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
0a18a4e763 Use the new tokenizing and breaking code instead of breakRow. 2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
ef88e31a1f Break the paragraph's big row according to margins
Still many features missing:
- handle insets that break rows (display math, newline, ...)
- handle rows that are too long by replacing the single call to
  breakAt with a call to a reworked Row::shortenIfNeeded.
- some easy things at the end of breakRow (bidi text, etc.).
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
963a0aa466 Implement Row::Element::row_flags
Move the enum definition RowFlags in its own include file, to avoid
loading Inset.h. Document it more thoroughly.

Rename RowAfter to AlwaysBreakAfter.

Add CanBreakInside (rows that can be themselves broken). This allow to
differentiate elements before bodyPos() and allows to remove a
parameter to shortenIfNeeded().

Make the Inset::rowFlags() method return int instead of RowFlags, as
should be done for all the bitwise flags. Remove the hand-made bitwise
operators.

Set R::E::row_flags when creating elements.
* INSET elements use the inset's rowFLags();
* virtual element forbid breaking before them, and inherit the *After
  flags from the previous element of the row;
* STRING elements usr CanBreakInside, except before bodyPos.

More stuff may be added later.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
f4d3702d4d Create new method TM::tokenizeParagraph
This contains large parts of breakRow, but creates a unique row for the paragraph.

The parts taken or not in redoParagraph are annotated.

The new method is not used yet.
2021-12-07 17:04:46 +01:00
Jean-Marc Lasgouttes
a558f78aa5 Small Row cleanups
Move declaration of RowList to Row.h

Move initialization of POD members of Row and Row::Element to declaration.

Make method isVirtual() depend on type.

Add new row element type INVALID and method isValid()

Make methods R::E::left/right_pos inline.

Add method R::E::splitAt() that returns an element containing the
remaining stuff, or an invalid element if nothing was split. breakAt
is now a simple wrapper around this function.

Add method R::push_back().
2021-12-07 17:04:46 +01:00
Jean-Marc Lasgouttes
1831f6caac Change FontMetrics::breakAt to return a position
Since we intend to break the row element in two, it is not good to
truncate the string too early.

Moreover, the row element width is now set at this point, even if no
breaking occurs.
2021-12-07 17:04:46 +01:00
Stephan Witt
ae56fb6171 Qt6 pixmaps are always HiDPI - avoid deprecate warning for setAttribute 2021-12-07 10:02:05 +01:00
Thibaut Cuvelier
489bf46a03 DocBook: recognise Tufte's float types (margin*). 2021-12-05 22:54:51 +01:00
Thibaut Cuvelier
bea2abf6eb InsetMathHull: fix column alignment for MathML.
https://www.lyx.org/trac/attachment/ticket/12221/0005-mathmlize-mathhull-checks-for-alignment.patch by lynx
2021-12-05 20:11:47 +01:00
Thibaut Cuvelier
a81dd6518a MathStream: better order for the calls to tab() and cr().
Part of https://www.lyx.org/trac/attachment/ticket/12221/0006-amends-to-a579128c-a68e9793-a68e9793.patch by lynx.
2021-12-05 19:15:06 +01:00
Thibaut Cuvelier
115ff2fa3c Similar fixes as 946ba7781c 2021-12-05 18:54:05 +01:00
Thibaut Cuvelier
946ba7781c Amend a68e9793: duplicate tag delimiter end. 2021-12-05 18:48:27 +01:00
Juergen Spitzmueller
31146ae8d3 Prevent Outliner crash due to emptied toc value
This might need a more profound fix in the long term, see
https://marc.info/?l=lyx-devel&m=163588729224679&w=2
2021-12-04 17:53:03 +01:00
Jean-Marc Lasgouttes
5eecfa3e04 When inserting text character in mathed, group in same \text when possible.
When inserting € in a math cell, it is put in a text inset and the
cursor leaves the inset. However, inserting ¤ then leads to
\text{€}\text{¤}.

Therefore, try to see if there is a previous \text inset that can be
recycled and insert the new inset there in this case, leading to
\text{€¤}.

Fixes bug #11979.
2021-11-28 14:33:45 +01:00
Daniel Ramoeller
e522c5444e InsertTableWidget support for dark mode and improved resizing
Fix for bug #12438.
2021-11-26 09:51:21 +01:00
Juergen Spitzmueller
a9eb3c9990 Whitespace 2021-11-25 18:47:23 +01:00
Juergen Spitzmueller
5a6498c3d3 Let paragraph::requestSpellcheck() consider contained insets
if "check whole paragraph" has been requested.
2021-11-25 17:04:58 +01:00
Juergen Spitzmueller
e366dba9bf Factor out Buffer::requestSpellcheck() function 2021-11-25 17:04:17 +01:00
Jean-Marc Lasgouttes
4dec64dba4 gzstream is able to read uncompressed files too
This allows to simplify the code in Lexer and to remove the dependency
on Formats class.

As a consequence, a pair of dummy definitions of isZippedFile can be removed.
2021-11-24 11:44:53 +01:00
Jean-Marc Lasgouttes
2311f42f41 Make primary-selection unknown when not supported
This lfun will not appear in menus anymore in macOS and Windows.

Part of bug #12436.
2021-11-22 10:30:43 +01:00
Jean-Marc Lasgouttes
b0983e1c5a Fixup 3aab9ad2: improve UndoGroupHelper docs again. 2021-11-14 19:14:31 +01:00
Jean-Marc Lasgouttes
741d055eba Fixup 1cbbe5c3: fix scrollbar with page down
It turns out that the fix was not correct. The right thing to do is to
recompte metrics only when screen has moved.

Fixes bug #12144.
2021-11-13 19:24:05 +01:00
Jean-Marc Lasgouttes
3aab9ad25e Fix documentation of UndoGroupHelper 2021-11-12 16:49:01 +01:00
Juergen Spitzmueller
16ce82d4f9 Fix Bullets panel (#12429) 2021-11-12 16:40:46 +01:00
Kornel Benko
20fd104cf2 FindAdv: Added handling of 0x019b 2021-11-12 13:29:22 +01:00
Juergen Spitzmueller
a90c5f202e Fix crash when closing LyX with open Search pane 2021-11-05 14:50:39 +01:00
Juergen Spitzmueller
1e711f902a Address Qt6 deprecation warnings 2021-11-03 17:41:41 +01:00
Juergen Spitzmueller
b60853ff0d Fix most stupid thinko of mine 2021-11-03 12:35:38 +01:00
Juergen Spitzmueller
de637cdbcb Amend 59b8c209c4
QFontMetrics::width() is no longer valid in Qt6
2021-11-02 16:28:40 +01:00
Daniel Ramoeller
59b8c209c4 Use labels for zoom slider buttons
Fix for bug #12301.

Also: fixes the width and alignment of the zoom value label.
2021-11-02 08:43:59 +01:00
Juergen Spitzmueller
bca1b63d89 Update toolbar and properly reset focus when find widget is closed (#12396) 2021-11-01 14:21:34 +01:00
Juergen Spitzmueller
455ff6fee7 More indentation correction 2021-11-01 14:15:05 +01:00
Juergen Spitzmueller
b9a9234cf6 Amend ce8b4e3a21 2021-11-01 13:08:16 +01:00
Juergen Spitzmueller
76ac4d8f8d Fix indentation 2021-11-01 13:02:05 +01:00
Daniel Ramoeller
a71c7f2154 Make color description "changed" rather than "added"
Fix for #12227 (regression).

Amended by Jürgen Spitzmüller
2021-11-01 12:47:11 +01:00
Juergen Spitzmueller
4888414f27 Attempt to fix #12226 for good 2021-11-01 08:30:41 +01:00
Juergen Spitzmueller
f3d5a95bb2 Redraw all work areas while zooming (#12334) 2021-10-31 13:43:27 +01:00
Juergen Spitzmueller
4c0caf9dd4 Polishing 2021-10-31 13:16:20 +01:00
Daniel Ramoeller
c50f40b522 Set Local Layout tab stop distance to 4
Fix for bug #12395.
2021-10-31 13:15:14 +01:00
Daniel Ramoeller
ce8b4e3a21 Movable minimised Quick Search Widget
Fix for bug #12207.
2021-10-31 13:06:36 +01:00
Daniel Ramoeller
528eee0a25 Adjust spacing of Quick Find Dock
Fix for bug #12209.

(amended by Jürgen Spitzmüller)
2021-10-31 12:33:08 +01:00
Juergen Spitzmueller
f0126b9fdf \\noindent in a paragraph that starts with \\vspace is possible
But the \\vspace must precede \\noindent (the latter leaves vmode)
2021-10-31 11:56:53 +01:00
Daniel Ramoeller
96a4dd235e Fix for bug #11974
Support for setUnifiedTitleAndToolBarOnMac (unify toolbar and title bar).
2021-10-31 10:42:14 +01:00
Juergen Spitzmueller
fbc64ea7ee Amend comment 2021-10-31 10:38:52 +01:00
Juergen Spitzmueller
456a72b62a Do not output \\noindent for paragraphs starting with a vspace
These are not indented anyway, and the extra \\noindent causes whitespace
2021-10-31 10:22:11 +01:00
Juergen Spitzmueller
18a91852e1 Properly terminate \\noindent 2021-10-31 09:58:10 +01:00
Juergen Spitzmueller
633013453e Factor out Paragraph::isPartOfTextSequence
Amends 045c25cf76
2021-10-31 09:26:57 +01:00
Juergen Spitzmueller
045c25cf76 Prevent unneeded (and wrong) \noindent
* When a paragraph is logically empty (only contains stuff which is not
  part of the text sequence

* In centered paragraphs
2021-10-30 14:19:46 +02:00
Juergen Spitzmueller
f3002d1cf4 Get rid of some more fragile index reliances 2021-10-29 17:52:25 +02:00
Jean-Marc Lasgouttes
110445e3e2 Rename BufferView::updateScrollbar to show what does
Only parameters are updated, not the scrollbar itself.
2021-10-29 17:45:51 +02:00
Juergen Spitzmueller
47b394f2c5 Amend [5c055034/lyxgit]
Relying on indexes is too fragile here
2021-10-29 17:06:11 +02:00
Jean-Marc Lasgouttes
5c055034c2 Fixup b0c102cfb: make it possible to select medskip as parskip
Some new parskip possibilities had been added, but the check for
custom length index had not bee updated.

This code is very fragile.

Related to bug #10968.
2021-10-29 16:41:00 +02:00
Juergen Spitzmueller
61fb295e46 Disable language selector in LyXFiles dialog if no file is selected (#12412) 2021-10-29 13:17:50 +02:00
Jean-Marc Lasgouttes
2c50f0cd77 An assert to hopefully please coverity 2021-10-29 12:39:50 +02:00
Yuriy Skalko
54028c3eea Mark inverted branch insets 2021-10-27 00:56:06 +03:00
Stephan Witt
436620a881 #12201 force open document in tabs on Mac when user preference is Always 2021-10-23 13:34:18 +02:00
Jean-Marc Lasgouttes
85f030a031 Let Tab go out of inset when no cycling is possible
Adapted patch from Enrico by adding S-Tab handling.

Fixes bug #11085
2021-10-21 22:42:40 +02:00
Jean-Marc Lasgouttes
2f236b01e0 Make sure that language is "latex" in InsetArgument when pass-thru.
The code that determine whether an InsetArgument is passThru is
complex and lives in updateBuffer.

This patch factors out the code in a new init method and calls it also
in doInsetInsert when inserting a InsetArgument.

Fixes bug #12143.
2021-10-21 19:14:06 +02:00
Pavel Sanda
6770fe5f38 * better wording 2021-10-21 16:01:57 +02:00
Pavel Sanda
985f7c9316 Improve error msg. 2021-10-21 15:20:28 +02:00
Juergen Spitzmueller
b55aea6776 Prevent unneeded cprotection in branches (#12378) 2021-10-21 10:27:05 +02:00
Thibaut Cuvelier
279e0a6839 DocBook: use the new refactorings in InsetText.
InsetText::docbookRenderAsImage directly used Qt to compute hashes, use the same code as support/FileName (now living in support/filetools).
2021-10-19 09:15:44 +02:00
Thibaut Cuvelier
0b5e940723 Refactor file-name sanitisation.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Thibaut Cuvelier
789a537182 Refactor computing hashes.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Jean-Marc Lasgouttes
40ee8d2a1a Reset inline completion after undo/redo
Fixes bug #12383.
2021-10-18 17:36:27 +02:00
Jean-Marc Lasgouttes
ada713a881 Revert "Update correctly completion after undo"
This reverts commit 06acb7f806.
2021-10-18 17:35:48 +02:00
Enrico Forestieri
e8b366d4d6 Amend 771f30e9 for cmake 2021-10-17 19:17:01 +02:00
Enrico Forestieri
3048878eab Amend 47f1fec9
Also account for cmake
2021-10-17 18:32:50 +02:00
Juergen Spitzmueller
3543626182 Do not change bibliography processor to default if it is not found
Rather than that, keep it with a warning that it is not available.
Fallback procedure (which maintains security measures) is done in
the conversion step.

This prevents document properties being silently changed on sharing.
2021-10-17 17:14:14 +02:00
Juergen Spitzmueller
f350072565 Provide proper fallback if a bibliography processor is not found
Check for appropriate fallbacks and warn user if the requested
bibliography processor is unavailable.
2021-10-17 17:14:14 +02:00
Enrico Forestieri
771f30e946 Enable QWindowsMimeMetafile with Qt6
The QWinMime class has been removed in Qt6 but the functionality
is still present. However, one has to allow inclusion of private
headers and register the mime handling to the QWindowsApplication
native interface.
2021-10-17 15:06:05 +02:00
Thibaut Cuvelier
21366155e4 DocBook: use a hash to determine the file names for generated images.
This way, the file names no more change without a reason.
2021-10-16 22:41:38 +02:00
Thibaut Cuvelier
33668e3a30 DocBook: export the preview images to the right format.
"docbook" is not the same as "docbook5", maybe it would be better to have an enumeration instead of strings.
2021-10-16 22:41:38 +02:00
Thibaut Cuvelier
e0830592f0 DocBook: wrong type of XML tag.
imagedata should have been a compound tag, because it should have no content, only its attributes are relevant (instead of a start-end pair of tags).
2021-10-16 22:41:38 +02:00
Jean-Marc Lasgouttes
a29ced5577 Get rid of std::iterator
clang's libc++ 13 tells us that it is deprecated in C++17.

Fortunately, we do not need it after all.
2021-10-15 18:13:09 +02:00
Jean-Marc Lasgouttes
d99502d915 Remove variable that is not used
Spotted by clang++ 13.
2021-10-15 15:49:40 +02:00
Jean-Marc Lasgouttes
5f4890721b Improve display of META_INSET in status bar. 2021-10-15 11:11:57 +02:00
Scott Kostyshak
1c70d98fc1 Fix sign-compare warning
Fix warning comparing long int to long unsigned int.
2021-10-14 23:50:08 -04:00
Pavel Sanda
f7de009b17 Guard against possible referencing null.
Those checks might not be needed, but it's not self obvious from
the surrounding code. Because we already experienced crash from
similar change (cf 1c1c83eced), let's be prudent here.

If you know that these pointers can't be null from broader context
feel free to remove the guards.

Introduced by 24926b2e23, fix 104fdcc9be not backported
but now fixed by 1c1c83eced in 2.3.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg216414.html
2021-10-14 22:28:43 +02:00
Jean-Marc Lasgouttes
06acb7f806 Update correctly completion after undo
This is take #2 after reverting e59aee458.

Request the completer to rebuild a completion after undo/redo.

Fixes #12383.
2021-10-14 16:39:33 +02:00
Jean-Marc Lasgouttes
91c5061d26 Revert "Reset inline completion after undo/redo"
Try a solution closer to other code instead.

This reverts commit e59aee4580.
2021-10-14 16:26:21 +02:00
Thibaut Cuvelier
7652747e26 DocBook: generate images for layouts that request it. 2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
3502f5c999 Factor out the generation of the code to create a preview.
This will be soon reused in InsetText to generate images for DocBook.
2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
b5533a24f4 Typos and comment improvements. 2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
46b8101800 Factor out the list of macro definitions for InsetPreview.
This will be soon reused in InsetText to generate images for DocBook.
2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
48a507694e DocBook: add assertion to help debugging. 2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
82bca97379 DocBook: overall structure for rendered insets. 2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
5c735ce880 DocBook: don't use a surrounding <para> for rendered insets. 2021-10-13 19:26:49 +02:00
Thibaut Cuvelier
e93e50bf56 DocBook: add the DocBookRenderAsImage tag. 2021-10-13 19:26:48 +02:00
Stephan Witt
b59eed3846 #12368 correct spelling of toolbars visibility check function name 2021-10-13 18:11:37 +02:00
Jean-Marc Lasgouttes
e59aee4580 Reset inline completion after undo/redo
Fixes bug #12383.
2021-10-12 15:45:04 +02:00
Jean-Marc Lasgouttes
c242b25364 Work around compilation warning
Clang 12 (at least) misses the fact that tag is always initialized,
because the if/else sequence does cover all cases.

Initialize the variable although it is not required. It does not hurt
at least.
2021-10-11 14:51:28 +02:00
Jean-Marc Lasgouttes
a5f1b15858 Make CoordCache assertions less annoying. 2021-10-09 12:25:29 +02:00
Jean-Marc Lasgouttes
0fff65a16a Avoid duplicate checks in CoordCache
The code is written in such a way that the elements are searched
several times. This can be expensive when there are a lots of insets
in the document.

Concerning the sanity checks, they are now conditionned on the
presence of assertion.

Related to bug #12297.
2021-10-08 18:17:19 +02:00
Jean-Marc Lasgouttes
e5bb491e2e Reduce the number of accesses to coord cache when drawing a math row
Each of these accesses is somewhat costly when using large branches
with lots of maths

Related to bug #12297.
2021-10-08 18:17:19 +02:00
Jean-Marc Lasgouttes
e09158efee Use unordered maps to store inset and math rows geometry.
Simply using unordered_map instead of map makes a big difference for
documents with lots of math insets in one text inset.

Related to bug #12297.
2021-10-08 18:17:19 +02:00
Scott Kostyshak
3ad94ec6d9 Minor refactor of previous commit
A bit easier to read and avoids unnecessary status.clear().
2021-10-07 20:40:12 -04:00
Daniel Ramoeller
b387ed52b1 Disable LFUN for last column/row deletion
Fix for #12380.
2021-10-07 20:40:12 -04:00
Juergen Spitzmueller
465b58a6df Check changed status after decimal sep has been edited 2021-10-06 18:06:09 +02:00
Yuriy Skalko
6a7c9d12f9 Amend d3c335a5d5 2021-10-05 17:10:51 +03:00
Juergen Spitzmueller
9a4a6ca079 Fix \cline calculation when last column has decimal alignment 2021-10-01 12:42:06 +02:00
Juergen Spitzmueller
9eab66ebb4 Close font switches before comments 2021-09-30 12:53:41 +02:00
Yuriy Skalko
d3c335a5d5 Remove useless casts reported by GCC with -Wuseless-cast option 2021-09-30 10:37:24 +03:00
Daniel Ramoeller
0862042b28 SVG replacement of busy.gif
Fix for bug #10384.
2021-09-29 12:49:56 +02:00
Jean-Marc Lasgouttes
42abb26054 Make paragraph-goto and friends set paragraph to the top
Add parameter 'force' to scrollToCursor(...) to avoid the case where the
cursor is not set to top because it is already visible on screen.
Change screen offset in this method so that the paragraph is really at
the top of the screen. This part may cause unforeseen issues and needs care.

gotoInset: use the new force flag and do not trigger a redraw.
Instead, return a boolean telling whether redraw is needed.
In the code that use it, set an update flag instead of the extra redraw.

In the handling of paragraph-goto, also set the update flag instead of
triggering a repaint.

Remove Bufferview::scrollToCursor(), which was equivalent to showCursor().

Fixes bug #10425.
2021-09-29 12:16:39 +02:00
Yuriy Skalko
a9119c3fa8 Remove redundant declarations reported by GCC with -Wredundant-decls option 2021-09-28 20:59:21 +03:00
Jean-Marc Lasgouttes
7067f48fa7 typo 2021-09-28 11:25:48 +02:00
Kornel Benko
84655a07d8 Fix crash
Lyx crashes on export to pdf if used with sanitizer set to 'unspecified'.
Crash found by Scott.

Given that if we export without GUI, there is some weirdness here though.
1.) Why does lyx not crash if not using '-fsanitize' compile-option
2.) Why is export to pdf dependent on the screen-resolution
2021-09-28 10:33:24 +02:00
Yuriy Skalko
325c405541 Remove redundant semicolons reported by GCC with -Wextra-semi option 2021-09-28 11:28:43 +03:00
Jean-Marc Lasgouttes
3cdfb42cce Make rectangles have pointy corners
This only makes a difference in HiDpi mode.

Adaptation of the patch proposed by Daniel.

Fix for bug #12336.
2021-09-27 17:47:41 +02:00
Jean-Marc Lasgouttes
69834f1e0d Fixup 6bbd88ac: compilation fix for Qt4 2021-09-27 13:56:04 +02:00
Jean-Marc Lasgouttes
73865ce999 Whitespace 2021-09-27 11:53:59 +02:00
Jean-Marc Lasgouttes
b3890d9eab Fix warning. 2021-09-24 18:45:08 +02:00
Jean-Marc Lasgouttes
6bbd88accf Improve (modestly) the performance of font metrics caches
This fixes two performance issues and improves the performance of
TextMetrics::redoParagraph by 15% in a workload that uses the cache a
lot. The difference will be much less when the cache is not used much.

1/ repetion of the hash code computation

The code
  if (cache.contains(key))
  	result = cache[key]:
is not efficient, since qHash(key) has to be computed twice.
To fix this a new Cache::object_str() method is added, which allows
  if (auto * obj = cache.object(key))
  	result = *obj;

2/ code of has code computation

Instead of using a verbose string that is complicated to build as
key, new key structs BreakAtKey and TextLayoutKey are introduced,
along with the relevant qHash() implementation.
2021-09-24 17:12:15 +02:00
Enrico Forestieri
9ae002b69f Fix bug #12373
Do not perform any autocorrection in the presence of a selection.
2021-09-24 10:17:32 +02:00
Kornel Benko
dd947300bc Amend dca39815: Fix a few warnings in Floating. 2021-09-24 10:08:02 +02:00
Thibaut Cuvelier
dca39815d3 Fix a few warnings in Floating. 2021-09-24 01:19:28 +02:00
Thibaut Cuvelier
ffa1b1dcc7 DocBook: add inner tags for layouts.
This makes it possible to implement LilyPond as prescribed in https://lilypond.org/doc/v2.22/Documentation/usage/docbook.
2021-09-21 01:21:25 +02:00
Thibaut Cuvelier
7ee23ca885 XML: add a check for a typical case in the xml name space.
IGNORE is a typical placeholder for tags that should not be output, along with NONE. At some point, we should check if both are required, or if NONE is enough…
2021-09-21 01:21:25 +02:00
Thibaut Cuvelier
14ed5b2050 DocBook: start implementing LilyPond.
All the changes that can be achieved without C++ code changes.
2021-09-21 01:21:25 +02:00
Kornel Benko
687ccdbb32 Complete the FontTag typeinfo 2021-09-20 11:52:16 +02:00
Thibaut Cuvelier
8b6e3d3749 DocBook: add more flexibility for floats.
Intended to fix #12371.
2021-09-20 00:06:20 +02:00
Thibaut Cuvelier
bde9b7afa0 Kill warning for uncovered code path. 2021-09-19 20:10:51 +02:00
Stephan Witt
c5262f04a2 #12247 disable Qt5 modifier hack for Qt-5.12 version or newer
Initially Qt5 modifier handling was broken. Therefore a workaround was introduced.
This workaround broke the LyX modifier handling with swap of Command-Control-key disabled.
The change disables the hack to get the correct behavior in LyX.
2021-08-23 14:44:36 +02:00
Juergen Spitzmueller
489549c9b4 Fix debug output 2021-08-21 15:19:30 +02:00
Juergen Spitzmueller
e8bf83e42b Correct tooltip
as advised by Scott
2021-08-21 15:19:07 +02:00
Juergen Spitzmueller
3f2510991d Recheck whole buffer after word has been added to/removed from document dic. 2021-08-21 15:18:30 +02:00
Pavel Sanda
20cee15937 Give the user visible feedback when reconfiguring. 2021-07-22 14:30:08 +02:00
Jean-Marc Lasgouttes
b0a74fa410 Count the width of pilcrows indicating changed end-of-par
This is related to #10357. The case of real end-of-par markers is
taken into account, but not "change" markers, which have been
introduced in 2.4.
2021-07-21 11:29:16 +02:00
Scott Kostyshak
bea7ef04e7 find: auto-wrap by default
For ML discussion on this change of default, see here:

  https://www.mail-archive.com/search?l=mid&q=20210602042644.g3s42nbeevdujzb5%40tallinn
2021-07-16 15:50:30 -04:00
Scott Kostyshak
47b0c33820 find: give status message when auto-wrapping
When auto-wrap is enabled, it is sometimes informative to know
when the search wraps.

A status message is consistent with LibreOffice and Vim.
2021-07-16 15:50:30 -04:00
Scott Kostyshak
abc65d4700 refactor: keep meaning of a variable consistent
We now use a new variable, "wrap", to track if a wrap should be
done, which is true either if "auto_wrap" is true or if the user
chooses to wrap in the dialog.

This preserves the meaning of the "auto_wrap" variable and also
removes the confusion of why the previous code of

  if (!auto_wrap) {
    ...
  }
  if (auto_wrap) {

did not use an "else" instead of the second "if".

No change in functionality.
2021-07-16 15:50:30 -04:00
Stephan Witt
4716b1f91a Use a central typedef for vectors of WordLangTuple. 2021-07-16 16:39:05 +02:00
Jean-Marc Lasgouttes
f3396ae011 Whitespace 2021-07-13 11:15:13 +02:00
Jean-Marc Lasgouttes
1c200e0d99 Revert "Add a move constructor to Inset"
It does not compile :-p

This reverts commit 874928f4a4.
2021-07-12 12:38:16 +02:00
Jean-Marc Lasgouttes
874928f4a4 Add a move constructor to Inset
Does not change much, but Coverity complains about it. Let's see if
this allows Inset's child classes to grow their own move constructor.

Also some whitespace.
2021-07-12 11:59:40 +02:00
Jean-Marc Lasgouttes
da57154f94 Rework display of numbers in margins of hull insets
This requires the introduction of the booleans selected_left and
selected_right in PainterInfo. These tell whether the selection
continues at the left/right of the inset.

This information allows to

1/ paint equation number in the right color: either current text color
   or selection text color.

2/ before that, paint a small background rectangle of the correct color.

This allows to avoid painting a large rectangle of an arbitrary color
that was the cause of the bug.

Fixes bug #12319.
2021-07-09 23:46:16 +02:00
Pavel Sanda
5dd96345ab Reformat mangled filenames for (xhtml) export to have them sorted. 2021-07-09 14:35:01 +02:00
Jean-Marc Lasgouttes
008a0825e8 Always remove selection after cursor up/down
When the cursor cannot move on cursor up/down, at least the selection
should be cleared (when not selecting).

To detect this, the method Cursor::upDownInText has been modified to
return true when cursor is at top/bottom of inset, but there is some
room above/below.

Moreover, introduce the functions LFUN_FINISHED_UP/DOWN, which is
dispatched at upper cursor level as long as no local movement is
possible. This allows to handle differently the original char moving
action and its consequences.

Fixes part of bug #12310.
2021-06-30 16:51:58 +02:00
Jean-Marc Lasgouttes
8d90bb9991 Always remove selection after cursor left/right
Example: when a selection is set, a `Left' cursor movement would not
reset selection when the cursor was at the beginning of buffer.

To fix this, it is necessary, when cursor is in top-level text, to
avoid the mechnanism (undispatched cursor) that sends the action to the
upper level (necessary when the cursor leaves an inset).

The change is mechanical and is done for : char-backward,
char-forward, char-left, char-right, word-left, word-right, word-left,
word-right. It might be possible to factor this code a bit, but there
is no evident solution.

char-up/down are *not* handled at this point.

Fixes part of bug #12310.
2021-06-30 16:41:18 +02:00
Eugene Chornyi
e9d5fc0190 prevent Qt6 from defining UNICODE (Qt6.1.1 and upwards) 2021-06-19 10:48:49 +02:00