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.
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.
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
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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 :)
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.
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.
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.).
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.
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.
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().
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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.
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…
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.
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.
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.
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.
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.
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.
Horizontally, the old code would count an extra pixel on the right.
The vertical test is not changed, and should be eventually audited.
Fixes bug #10468.
I wanted to remove the test Qt >= 5.15, but now I see that it is
not possible because of QProcess::splitCommand.
Neverthless, the best would be to change parsecmd.
QWidget::focusNextPrevChild() passes over to the parent (which is the
work area here) if the current window is not a dialog (isWindow()) or
a sub-window (window flag Qt::SubWindow).
We set the latter here to prevent this unwanted behavior.
Let's see if there are side-effects.
A series of commits, culminating at 812ff7de, pushed a few days later,
fixes the bug at its root. This one is not needed anymore to fix
This reverts commit 001f5a4786
When the buffer stuff has been updated, the Buffer::needUpdate()
should be reset to false. This was forgotten in f3a0e8ff.
Fixes performance issues with MergedManuals, for example. UpdateBuffer
would be run again and again when selecting text.
Introduce a GUI-less LyXRC member bookmarks_visibility. This is
experimental and will not be documented for 2.4.0. Having the code
present will allow to (1) improve it gradually and (2) fix the many
bookmarks bugs that it exposes.
The corresponding tag is \experimental:bookmarks_visibility, which is
intentionally weird.
Three possible values:
* none: no bookmark display
* margin: display the bookmark in margin
* inline: display the bookmark at cursor position.
The default margin has been made wider so that there is room for the
bookmark. This was necessary anyway. The margin bookmark is now
displayed correctly in full screen with limited text width.
Margin display still needs some improvements when several bookmarks
are on the same row.
Mostly fixes bug #2496.
1/ fix horizontal position of the insets
This is adapted from parts of racoon's patch for bug #12131.
2/ fix height of the indicators when at the top or bottom of document,
by using the row's contents_dim() to measure is height.
3/ fix partial blinking of horizontl scrolling marks when editing table.
Fixes bug #12171.
It was an error using an absolute size instead of one relative to the
size of the used font. It was requiring using the physical dpi of the
screen and caused #12222. Now everything is computed with respect to
the metrics of the font and should be automatically correct.
Fixes#12222.
This is for choosing a local document class/layout file. The tooltip
uses the 'class' language already, and "Local Layout" conflicts with
the way that term is used elsewhere in the dialog.
Add new funciton Debug::badValue, that returns the first bad value in a debug
setting string.
Use it to parse the -dbg comand line option and to control the
execution of the debug-level-set lfun.
Use range-based loops in a few places.
Patch from P. De Visschere
Citing:
I also must exclude the QMacPasteboardMimeGraphics class in
GuiApplication.cpp since QMacPasteboard is not available anymore with qt6.
and add an #include <QStandardPaths> in support/Package.cpp (I suppose
this will pose no problem for qt5 but have not checked it, it's only
needed with USE_MACOSX_PACKAGING)
Now it is possible to set this font directly instead of relying on
metrics() side effects. Do that to avoid crashes due to bad
interactions.
This implements the new scheme that was mentionned in 5a58ca65.
Fixes bug #12204.
This code was previously in InsetCollapsible for no good reason.
Move it to a new function InsetText::setOuterFont, which can now be
called for other purposes.
Part of investigation of bug #12204.
The font is already set to the buffer font when called from
TextMetrics::redoParagraph and RowPainter::paintInset, because
inheritFont() is false.
Part of investigation of bug #12204.
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
It turns out that the commit from gadmm's lyx-unstable has been
cherry-picked at the wrong place! However I believe that both changes
are necessary.
With this second patch, I do see that some screen jumping is avoided.
Fixes bug #7457.
Outputing the FuncCode enum to a stream using the << operator does not
work well. Actually I am not sure whether the << operator in LyXAction
is supposed to work (don't we need an enum class for that?).
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg215733.html
Main issue is git log does not return >0 when file does not exists.
Other possible issues to check - cvs might want to connect to server
with cvs log. In large git archives reaching the proper record might take
longer time than ls-files.
If started from console, the console is the parent process, which can be attached. If started not from console, parent process does not exist and the block is skipped.