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.