This arguments are shared_ptr objects, so they are not expensive to
copy. However, it makes sense to pass such pointers by const reference
when they are just intended for reading.
Some reading about this issue is here:
https://www.internalpointers.com/post/move-smart-pointers-and-out-functions-modern-c
Fixes some Coverity scan defects.
The situation of the convert<>() template was a mess: the header
announced that template specializations passed strings by address (my
doing long ago), but the code would just define versions that upass
strings by value.
The solution is to pass all values by address. This works very well,
_except_ when the value is a string litteral.
Defining the templates thus requires a bit of work.
Spotted by Coverity scan.
jlreq layout defined the abstract environment to be boxed
in the preamble. Doing any kind of typesetting before
all the setup has finished is error prone and may lead to
wrong output (wrong fonts for example). The correct
place to put the abstract code is right before \maketitle.
The Chinese docs loaded the ctex package in case system fonts
were used. Now, with the new support for languages with babel
and polyglossia it is no longer necessary and creates collisions.
This function is used a lot to initialize static docstrings. This is
an issue in theory because lyxerr may not have been initialized in
time.
In practice of course, lyxerr will only be used when there is a
non-ascii character in the parameter, which is really not supposed to
happen.
This gets rid of 75 coverity reports.
BOTTOM shows the paragraph containing the cursor at the bottom of the
work area.
TOGGLE does CENTER, then TOP, BOTTOM and finally cycles to CENTER.
This is a feature copied from emacs's C-l binding.
Add new argument "caret" to lfun "scroll" that can be used like
scroll caret center
Change the keys (either C-l, M-l or F5) bound to screen-recenter to
"scroll caret toggle".
As an experiment, change paragraph-goto to use this scrolling method.
This can be tested when going to a heading in the outline pane.
Since BufferView::scroll() does not correct scrolling amount at
top/bottom anymore, remove its return value and add a new one to
BufferView::updateMetrics(bool) that returns this correction.
Rely on updateMetrics(false) to set the metrics straight after moving
the anchor y position.
Use assert_in_view = false when calling TextMetrics::editXY() because
this parameter does not work as advertised: if an inset not totally
visible, the code will not try to go inside it to look for a smaller
row that is totally visible.
Two small (hopfully useful) modifications:
- take into account the cursor X target instead of its screen position
- adapt the cursor position depending on
lyxrc.mac_like_cursor_movement when hitting start or end of
document.
LFUN_SCROLL was the last user, change it to use only scroll(). Take
this opportunity to improve a bit this dispatch code.
Also improve somewhat the methods documentation.