Commit Graph

47102 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
ffca6730d6 Fix uninitialized variable
Spotted by Coverity scan.
2024-09-13 11:21:19 +02:00
Jean-Marc Lasgouttes
9f40eaee15 Do not use rand() to set a BranchList id
Use a simple counting instead, beecause Coverity complains that rand()
is not safe, and counting is siimpler anyway.
2024-09-13 11:09:30 +02:00
Jean-Marc Lasgouttes
9b3c28178c Make string parameter a const reference
Spotted by Coverity scan.
2024-09-13 10:27:24 +02:00
Jean-Marc Lasgouttes
8e181e992d Avoid a couple of copies.
Spotted by Coverity scan.
2024-09-12 18:33:45 +02:00
Jean-Marc Lasgouttes
7a99ef7fbb Make docstring parameters const references
Spotted by Coverity scan.
2024-09-12 18:28:26 +02:00
Jean-Marc Lasgouttes
b743870d71 Graph::getReachable(): pass a parameter by const reference
Spotted by coverity.
2024-09-12 18:20:43 +02:00
Jean-Marc Lasgouttes
b1bbf64a28 Avoid a copy
Spotted by Coverity scan.
2024-09-12 18:05:50 +02:00
Jean-Marc Lasgouttes
cc40330e00 Avoid a couple of copies
Spotted by Coverity scan.
2024-09-12 17:59:41 +02:00
Jean-Marc Lasgouttes
91f3f27545 GuiWorkArea: pass KeySymbol parameters as const references
Spotted by Coverity scan.
2024-09-12 17:52:57 +02:00
Jean-Marc Lasgouttes
8ea9c2da03 Avoid a couple copies in Trans::addDeadKeys().
Spotted by Coverity scan.
2024-09-12 17:24:32 +02:00
Jean-Marc Lasgouttes
7946dfacfa TransState::addkey() pass parameter by const reference
Spotted by Coverity scan.
2024-09-12 16:54:02 +02:00
Jean-Marc Lasgouttes
eeb84bce17 Pass three string parameters by address
Spoted by Coverity scan.
2024-09-11 17:33:52 +02:00
Jean-Marc Lasgouttes
13b05102f2 Pass a docstring parameter by address
Spotted by Coverity scan.
2024-09-11 17:30:33 +02:00
Jean-Marc Lasgouttes
e6930ffec8 Pass a pair of docstring arguments by address
Spotted by Coverity scan.
2024-09-11 17:25:03 +02:00
Jean-Marc Lasgouttes
851e59cd26 Avoid an unnecessary string copy
Spotted by Coverity scan.
2024-09-11 17:08:45 +02:00
Jean-Marc Lasgouttes
a47d66df34 Pass arguments by address in convert() templates
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.
2024-09-11 16:43:26 +02:00
Jean-Marc Lasgouttes
291d2db18e Fix linking of test programs in support/. 2024-09-11 16:42:41 +02:00
Jean-Marc Lasgouttes
100075c890 Pass parameters of constructor by address
Spotted by Coverity scan.
2024-09-11 16:25:45 +02:00
Jean-Marc Lasgouttes
951cb62f47 Fixup 716e20ae: revert useless part 2024-09-11 13:37:32 +02:00
Jean-Marc Lasgouttes
716e20ae1b Limit the number of iterations for some tabular features in math
Try to please Coverity scan.
2024-09-11 13:29:20 +02:00
Jean-Marc Lasgouttes
3f5b836aa9 Make some code that handle authors more readable
Create accssors authodmap() in BufferParams.

Use [] operator instead of find().

Hopefully this will avoid to confuse Coverity scan.
2024-09-10 15:32:49 +02:00
Udi Fogiel
54601b5578 update test 2024-09-10 15:44:42 +03:00
Scott Kostyshak
7fb059bce4 Whitespace 2024-09-10 14:23:37 +02:00
Udi Fogiel
abd35bc33c fix jlreq abstract layout and adapt Chinese docs for unicode engines
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.
2024-09-10 15:17:07 +03:00
Jürgen Spitzmüller
498135ef38 Do not push options to \babelprovide which do not make sense there
Should fix a couple of tests
2024-09-10 13:58:33 +02:00
Thibaut Cuvelier
e1efc70959 Add a comment for Python binary names. 2024-09-09 23:32:07 +02:00
Jean-Marc Lasgouttes
2ea95fa71b Improve coverity modeling
This tells coverity that these functions terminate the program.
2024-09-09 17:50:01 +02:00
Jean-Marc Lasgouttes
f4c02d670b Do not forget to reset stream after std::hex
Spotted by Coverity scan.
2024-09-09 17:49:20 +02:00
Jean-Marc Lasgouttes
6687b34c07 Do not handle special case where buffer == NULL
If it is so, we have already crashed in isBranchSelected() above.

(and hopefully, buffer_ is never null these days).

Spotted by Coverity scan.
2024-09-09 15:52:01 +02:00
Jean-Marc Lasgouttes
ffde470363 Do not access current_view_ if it is NULL
Spotted by Coverity scan.
2024-09-09 15:35:57 +02:00
Jean-Marc Lasgouttes
3d323412ad Initialize client's name in main()
Initializing clientName at declaration time is not a good idea.

Spotted by Coverity scan.
2024-09-09 15:33:02 +02:00
Jean-Marc Lasgouttes
12d771c43f Fixup b8cdfd1e1d: fix thinko
Spotted by Coverity.
2024-09-09 15:19:25 +02:00
Jean-Marc Lasgouttes
ed291f0d4f Do not use lyxerr in from_ascii(char const *)
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.
2024-09-09 15:08:36 +02:00
Juergen Spitzmueller
f725abea05 adapt tex2lyx to 0beb790a6a 2024-09-09 08:29:24 +02:00
Juergen Spitzmueller
0beb790a6a Handle space issue with refstyle more downstream
It is not necessarily, and infers with some usages, to generally escape
spaces in labels and references
2024-09-08 19:07:44 +02:00
Juergen Spitzmueller
bfd855747a Fix indentation 2024-09-08 16:00:36 +02:00
Scott Kostyshak
0a75854038 Fix compiler warning
Fixes the following warning:

  warning unqualified call to 'std::move' [-Werror,-Wunqualified-std-cast-call]
2024-09-07 23:45:51 +02:00
Juergen Spitzmueller
d3123c16f7 initialize boolean (reported by coverity) 2024-09-07 12:55:10 +02:00
Juergen Spitzmueller
e685d31f5a use std::move() instead of copying when value is no longer used
This is mainly to shut down coverity which nowadays nags on this.
I am not sure whether we really gain something in these cases.
2024-09-07 12:50:27 +02:00
Juergen Spitzmueller
458f39cc43 Fix cut and past error (reported by coverity) 2024-09-07 12:39:45 +02:00
Juergen Spitzmueller
35b832f344 fix potential null pointer (reported by coverity) 2024-09-07 12:36:23 +02:00
Pavel Sanda
70ab623c6e * postats.py 2024-09-06 23:06:52 +02:00
Jean-Marc Lasgouttes
e5c31699b4 Remove handling of dispatched() property in BufferView::dispatch
As indicated in DispatchResult.h, this is only needed in insets'
doDispatch() methods, where lfuns can be delegated to a higher lever.
2024-09-06 16:21:47 +02:00
Jean-Marc Lasgouttes
6c20e5db7d Add ScrollType BOTTOM and TOGGLE for BufferView::scrollToCursor()
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.
2024-09-06 12:21:42 +02:00
Jean-Marc Lasgouttes
9c443d9651 Cleanup Page Up/Down code
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.
2024-09-05 16:57:35 +02:00
Jean-Marc Lasgouttes
439b7bb9c9 Get rid of BufferView::scrollUp/Down
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.
2024-09-05 16:56:13 +02:00
Jean-Marc Lasgouttes
f52842d289 Streamline BufferView::scrollToCursor
There are two parts in this patch :

1/ in the part where the cursor is already visible, replace calls to
scroll/scrollUp/scrollDown by direct manipulation of the anchor
vertical position. Reasoning in terms of new position rather than
amount of pixels to scroll makes work easier.

2/ in the part where the cursor is set to a new TOP or CENTER
position, move the code around in order to prepare for new ScrollType
enums.

No change intended, except that CENTER now relies on the contents
dimension of the row that holds the iterator, that is without spacing
and labels.
2024-09-03 17:45:48 +02:00
Jean-Marc Lasgouttes
86d2313ce3 Simplify greatly Buffer::scroll/Up/Down methods
The code there that checks whether we scroll beyond the top/bottom of
document is not needed anymore, this is handled later by
BufferView::update(bool).

Note that this methods may disappear with time.

No change intended.
2024-09-03 15:58:55 +02:00
Jean-Marc Lasgouttes
16be88ca18 Fix update of cursor in tab-delete when there is a selection
The position of the cursor should not be decreased if it is already at
the start of the paragraph. This can lead to a crash when trying to
display the caret.
2024-08-30 16:56:16 +02:00
Jean-Marc Lasgouttes
2eb4e3d3ca Fixup 999fb37e: fix thinko
The current buffer is part of allRelatives(), contrary to what I
thought. Therefore updateId() increased the buffer id by two.
2024-08-30 15:07:03 +02:00