The handling of Update::FitCursor traditionnally recomputes all
metrics once or twice. Now that updateMetrics(false) ensures that all
paragraphs that require it have a metrics, we might as well use that.
Take this occasion to move handling of Update::SinglePar earlier,
before the check for Update::ForceDraw.
The missing metrics computation meant that, when loading a file, the
workarea would not be scrolled correctly to show the cursor.
The resizeBufferView does not create an additional metrics
computation, it just triggers it earlier.
This is triggered by selecting part of an equation under Xcb platform
(x11). Indeed, the current selection has to be sent to the X11 server
and BufferView::requestSelection() is called. Eventually
cap::grabSelection() is the function that creates this partial
MathData object.
Fixes ticket #12947.
The code that handles this special macro insertion (in
Cursor::mathMacroClose())) is very weird: it inserts the contents of
the macro _after_ the macro and later, since the macro is 'greedy', it
will eat this contents and put it in its first macro cell.
Does it make sense to you? It does not ake sense to me either. Anyway,
this is the point where one should make sure that the buffer is set.
Fixes ticket #12682.
When debug (-g) is enabled (default when compiling a development
version), the existing -O optimization level is not correct, since
many variables are optimized out when debugging.
Use -Og instead, and condition not on compiling a development version,
but on --enable-debug. This is the same by default, but it more
precise in our case.
Make sure that math insets have a proper buffer. To this end, make the
Buffer* parameter of InsetMath mandatory and fix the compilation
errors that ensue.
In order to ensure that MathData objects have a valid buffer, the
default MathData() constructor is deleted. This means that a buffer
shall be specified for each MathData object created.
This is fairly mechanical, actually. In particular, in most
InsetMathXxx cases, in MathData and in MathParser, the available
buffer_ member is used.
More specific cases:
- lyxfind.cpp takes the buffer from the Cursor
- calls to vector<MathData>::resize take an additional
MathData(buffer_) parameter. There are cases where resize actually
remove cells, and in this case clear() or even erase() have been
used.
- in InsetMathMacroTemplate, the optional parameters of the
constructors cannot be allowed anymore (a default value cannot
depend on another parameter). Therefore there a now two constructors
instead.
- in MathAutoCorrect.cpp, the MathData objects are not bound to a
buffer, so that std::nullptr is used instead.
- in MathExtern, use a buffer when one is specified, std::nulptr
instead.
Set the buffer of contents that is added to a MathData object through
MathData::insert() (both versions)
MathData::push_back()
asArray()
Also in math macros, initialize look_ with the relevant buffer.
This reduces the number of insets hat do not have a proper buffer.
See #13050 for discussion of this issue.
Now that SingleParUpdate does not always lead to a full screen update
when the height of the paragraph changes (see new behavior of
updateMatrics(bool)), it is necessary to make sure that the grey area
below the main page is always repainted.
When a buffer is reloaded, its content may remain the same, but the
memory allocation is new, so that the inset pointers in cursors are
now wrong. This requires to sanitize the cursors held by the buffer
views.
Before the biginset branch, some full metrics computation call that is
now removed probably did that as a side effect. Now we have to be more
precise.
To this effect, introduce WorkAreaManager::sanitizeCursors() and use
it in Buffer::reload().
- avoid copying of configure.log
- avoid copying of chkconfig.ltx
There is a report of a hang on first start of LyX with new major release.
The removal of the chkconfig.ltx (leftover from early LyX versions) fixed the issue.
When the width of the window did not change, computing full metrics is
not necessary in BufferView::resize(), but it is better to redraw the
screen (especially with Wayland).
Typical use cases are when using M-x to open the minibuffer or going
in and out of an equation (which shows/hides the math toolbars).