Commit Graph

29585 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
58ee4c9ec7 Pass DocumentClassConstPtr arguments by const reference
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.
2024-09-13 14:16:21 +02:00
Jean-Marc Lasgouttes
3649cea9e5 Make two parameters const references 2024-09-13 11:27:00 +02:00
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
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
Scott Kostyshak
7fb059bce4 Whitespace 2024-09-10 14:23:37 +02: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
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
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
Jean-Marc Lasgouttes
53c8e0b77d update comments 2024-08-30 14:53:07 +02:00
Jean-Marc Lasgouttes
3c59a9a23c Remove legacy code to compute geometry
This code is not necessary anymore after the fix to #13069.

Remove the first QString argument to createView(). Set the autoShow
parameter to false by default and rename createView(id) to
createAndShowView(id) to avoid member function overloading issues.

Remove optional <GEOMETRY> argument of window-new lfun.
Document the removal of the argument in release notes.
2024-08-30 14:45:36 +02:00
Jean-Marc Lasgouttes
18c310a8cf Get rid of QPA_XCB define
Since the platform is selected at run time (e.g. xcb vs. Wayland), it
is not a good idea to decide at compile time what code is run. Another
example is on macOS, where having xcb libraries available will lead to
lauching the Xquartz whenever LyX is running.

With this patch, things are separated:
- the code is run when run-time platform is "xcb".
- the support code is compiled in when xcb header and libraries are
  available.

Fixes ticket #13086.
2024-08-30 11:27:17 +02:00
Jean-Marc Lasgouttes
ce9de28f06 Streamline -geometry command-line option support
Instead of baking our own support for -geometry command line option on
Windows (Qt only does that for Xcb), use the fact that Qt 5 provides
the equivalent -qwindowgeometry flag.

All we need to do is to replace the -geometry option with -qwindowgeometry.

This is part of the effort in ticket #13086 to get rid of the
compile-time QPA_XCB define.
2024-08-30 11:15:02 +02:00
Kornel Benko
f1fddd86ef Cmake build: Add defines for HAVE_XCB_XCB_H and HAVE_LIBXCB 2024-08-29 14:08:39 +02:00
Jean-Marc Lasgouttes
52ec69a1af Force a metrics update of buffer after reload
It makes reload more robust and is in any case good enough to avoid
crash in #139091.

Fixes bug #13091.
2024-08-27 00:09:04 +02:00
Juergen Spitzmueller
8205458857 Reset lang_options before reading headers 2024-08-26 07:35:34 +02:00
Juergen Spitzmueller
b1b8ded15d output babel options via \babelprovide in all cases needed 2024-08-26 07:20:58 +02:00
Juergen Spitzmueller
686b55e70d Amend fc605cf138
Use proper option if main and a secondary language have BabelProvide 2
2024-08-25 18:01:26 +02:00
Juergen Spitzmueller
17ca2ac89c Properly set the babel bidi option (#12862) 2024-08-25 15:21:56 +02:00
Juergen Spitzmueller
fc605cf138 Add proper support for BabelProvide 2
We need to instruct babel not to load an existing ldf in this case
2024-08-25 14:56:05 +02:00
Juergen Spitzmueller
1ba7f104bf Fix typo in UI file 2024-08-25 13:39:18 +02:00
Juergen Spitzmueller
9e5bf47a68 Update tex2lyx tests 2024-08-25 13:26:06 +02:00
Juergen Spitzmueller
66aa0d8699 Avoid empty option in babelCall 2024-08-25 13:23:57 +02:00
Juergen Spitzmueller
b625138be6 Add support for the following languages
Polyglossia:
Chinese (Simplified), Chinese (Traditional), Japanese, Kurdish (Sorani),
Latin (Classic), Latin (Ecclesiastic), Latin (Medieval), N'ko, Odia,
Punjabi, and Uyghur

Babel:
Amharic, Armenian, Asturian, Bengali, Church Slavonic, Coptic, Divehi,
Kannada, Kazakh, Khmer, Kurdish (Sorani), Lao, Latin (Classic),
Latin (Ecclesiastic), Latin (Medieval), Malayalam, Marathi, N'ko,
Occitan, Odia, Punjabi, Russian (Petrine orthography), Sanskrit, Syriac,
Tamil, Telugu, Tibetan, Urdu, and Uyghur
2024-08-25 13:22:07 +02:00
Juergen Spitzmueller
a2629b8eab Assure OK/Apply button is initially disabled in InsetParamsDialogs (#8927) 2024-08-25 10:18:38 +02:00
Juergen Spitzmueller
047dee5a3b Basic support for \babelprovide
This is the new(er) babel mechanism to load languages via babel *.ini
files.

Some languages (or varieties) are only supported this way, some work
better with unicode engines this way (for the latter case, we have
BabelProvide 2)
2024-08-25 09:46:29 +02:00
Juergen Spitzmueller
7e09f574ba Add BabelOpts to languages
This way, some settings that were hardcoded in BabelPreamble are
customizable in document settings
2024-08-24 14:30:37 +02:00
Juergen Spitzmueller
8ff3e467a1 Avoid duplicate option passing with babel 2024-08-24 05:54:54 +02:00
Juergen Spitzmueller
401b783575 NomenclUI: fix spacer
This seems t be a bug in my Qt designer
2024-08-24 05:45:17 +02:00
Juergen Spitzmueller
285f467f24 Provide babel language options only for languages that have options 2024-08-24 04:51:45 +02:00
Pavel Sanda
ad0d5f9d40 Not needed anymore. 2024-08-23 21:35:53 +02:00
Juergen Spitzmueller
8a8d2d93d1 No need to decorate roots in one-level tree widgets 2024-08-23 18:00:58 +02:00
Juergen Spitzmueller
3c852439a6 Fix language options glitches 2024-08-23 16:46:30 +02:00
Juergen Spitzmueller
21252f924b update tex2lyx tests 2024-08-23 16:13:53 +02:00
Juergen Spitzmueller
2889e98d01 Amend 7e49ae7b13 2024-08-23 16:06:50 +02:00
Juergen Spitzmueller
7e49ae7b13 Add support for language options (#8034)
File format change.

Note that this cannot be properly reverted to LyX 2.4, so any options
will simply vanish on reversion or roundtrip
2024-08-23 15:52:34 +02:00
Scott Kostyshak
cdbdd4c7c5 Update tex2lyx tests 2024-08-22 12:04:11 -04:00
Scott Kostyshak
72f4acf66c Fix Python SyntaxWarning
Use raw strings to avoid the following syntax warnings that show up
in LastTest.log after running tex2lyx ctests:

  src/tex2lyx/test/runtests.py:135: SyntaxWarning: invalid escape sequence '\o'
    if linex[:-1] == '\origin ' + inputdir + '/':
  src/tex2lyx/test/runtests.py:136: SyntaxWarning: invalid escape sequence '\o'
    lines1[i1] = '\origin ' + outputdir + '/' + "\n"
2024-08-22 10:54:02 -04:00
Juergen Spitzmueller
ceaaacd8e3 typos 2024-08-22 09:42:40 +02:00
Juergen Spitzmueller
739e9a2382 Oops ... 2024-08-22 09:30:48 +02:00
Juergen Spitzmueller
b73000a495 The InsetPrintNomenclature settings make no sense with nomentbl 2024-08-22 08:17:33 +02:00
Juergen Spitzmueller
33869b62bf Add GUI support for nomencl options 2024-08-22 08:11:18 +02:00
Juergen Spitzmueller
0ca600b93b \use_nomentbl -> \nomencl_opts
This allows for support of more options

As the param is only a few hours old, no lyx2lyx handling is needed
2024-08-22 05:35:47 +02:00
Juergen Spitzmueller
47176ce34c Amend 13ee0bc8cd
Improve tex2lyx handling
2024-08-21 17:54:06 +02:00
Juergen Spitzmueller
954be0907b update tex2lyx tests 2024-08-21 17:39:36 +02:00
Juergen Spitzmueller
13ee0bc8cd Add support for the nomentbl nomenclature option
file format change
2024-08-21 17:39:36 +02:00
Koji Yokota
f88ee87d1c Fix wrong preedit cursor position in Qt5 2024-08-20 22:44:39 +09:00
Pavel Sanda
e322ef153d Fix regression introduced via #12819.
We will mark buffer as modified only in case of removal,
not when just externally modified.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg222715.html
2024-08-19 22:03:16 +02:00
Pavel Sanda
d5da93628a Header not needed anymore. 2024-08-19 21:47:16 +02:00
Juergen Spitzmueller
1429552063 Improve output pane, as discussed in #12372
* The image scale param is shared by XHTML and DocBook
* It does not only apply to math
* Get rid of redundant group headers (#12902)
2024-08-18 18:18:07 +02:00
Juergen Spitzmueller
03c5842006 Add "needcopiesfrom" converter flag
This is needed to provide ePub and other DocBook-based exports with
the right (renamed) images (fixes #12372)
2024-08-18 17:53:51 +02:00
Juergen Spitzmueller
fe43d03448 Assure widest nomencl label is encodable 2024-08-18 09:59:37 +02:00
José Matos
34a616bd91 Add another option to get python by using the unversioned name 2024-08-16 17:33:14 +01:00
Juergen Spitzmueller
712600dd6c Consider known latex text macros (basically the logos) in convertaTeXCommands() 2024-08-16 11:23:57 +02:00
Thibaut Cuvelier
8ae1b9554c Fix typo in comment. 2024-08-15 15:40:31 +02:00
Juergen Spitzmueller
c993485782 Disable valign widget in tabularx tables
See https://marc.info/?l=lyx-users&m=172363857509065&w=2
2024-08-14 16:28:15 +02:00
Juergen Spitzmueller
6b0c243cda Unbreak GuiTabular::fucEnabled()
I wonder how long this has been broken (if it ever worked)
2024-08-14 16:27:20 +02:00
Enrico Forestieri
d632753dea Improve detection of our math fonts
It turns out that Qt font selection via style name is broken on
Windows (QTBUG-101436). As we use our own style name for discriminating
our math fonts and applying proper kerning, we need a fallback method.
With this commit we check for the family name when the style name does
not match. In computing the kerning we also consider the right bearing
reported by the font instead of the width of the enclosing bounding box,
as this produces better results (see bug 13087).

Fixes #13087.
2024-08-13 22:51:40 +02:00
Juergen Spitzmueller
0659af15fb Add InsertCotext tag to InsetLayout
Avoids hardcoding of insets, and this behavior is possibly useful to
other insets than index and nomencl

We take this on yesterday's layout format change
2024-08-13 07:29:14 +02:00
Juergen Spitzmueller
6fa0532ed4 Escape special chars in indexes
We now have the functionality via sub-insets, and unexperienced users
are surprised when they don't get a literal !.

The unescaped chars can still be used via ERT.
2024-08-12 17:10:57 +02:00
Juergen Spitzmueller
0d87a3aab2 Omit escape-chars in pass_thru context 2024-08-12 14:28:59 +02:00
Juergen Spitzmueller
99fcf9df0e remove unused param 2024-08-12 13:15:02 +02:00
Juergen Spitzmueller
221a5c45dc update tex2lyx tests 2024-08-12 12:35:07 +02:00
Juergen Spitzmueller
a5841b3312 Transform InsetNomenclature to a collapsible
Fixes: #10460, #12595, #6353
2024-08-12 12:33:16 +02:00
Juergen Spitzmueller
8847651623 Add EscapeChars layout tag
This allows to define chars to be escape and an escape character

Needed in index and nomenclature
2024-08-12 12:25:31 +02:00
Pavel Sanda
28cb88d608 Header not needed. 2024-08-09 09:47:36 +02:00
Pavel Sanda
fb87ed74bd Header not needed. 2024-08-09 09:45:12 +02:00
Juergen Spitzmueller
90a876a049 enhance debug message (see #13087) 2024-08-07 14:46:30 +02:00
Richard Kimberly Heck
b494286a9c Fix bug with display of reference tooltips.
Previously, the tooltip was assigned during updateBuffer. But then
we could not determine the value for forward references.
2024-08-06 11:31:35 -04:00
Juergen Spitzmueller
8aeee03e3a set toc_string_ before the label is being truncated
We do not want truncated items in the outliner.
2024-08-06 10:57:11 +02:00
Richard Kimberly Heck
1de4645286 Use the old-style sorts of label strings in the TOC.
There are several reasons to do it this way, among which is odd
behavior of the TOC filter if we put anything else there. This also
allows for filtering of the references themsevles in a natural way.

The change, I think, was really an unintended consequence of other
changes connected to showing formatted references in the work area.
2024-08-05 18:13:07 -04:00
Juergen Spitzmueller
9fc1194494 Amend 9464f0526e
Simplify function
2024-07-30 15:30:41 +02:00
Juergen Spitzmueller
9464f0526e Fixup LFUN_REFERENCE_TO_PARAGRAPH for captions in other buffers
The movement to the caption is now done in the LFUN function itself,
as we need the DocIterator in the caption

This greatly simplifies the code in the TocWidget and shifts all the
complexity to the LFUN itself
2024-07-30 12:36:20 +02:00
Juergen Spitzmueller
4ed822925f fixup REFERENCE_TO_PARAGRAPH:
* par id actually can be 0
* properly move on in the buffer list if paragraph is not found
  in the current buffer
* use dit to get label (as this might be in a different buffer)
2024-07-30 09:49:34 +02:00
Juergen Spitzmueller
2c4536c709 typo 2024-07-29 09:11:42 +02:00
Juergen Spitzmueller
7d46ddaa95 rename Paragraph::getLabel()
getLabel() usually refers to a paragraph label (e.g. \item) in this
context, not \label as in the case here.
2024-07-29 09:08:13 +02:00
Juergen Spitzmueller
2fdeee4bf7 fixup definition of LFUN_REFERENCE_TO_PARAGRAPH 2024-07-29 08:46:43 +02:00
Juergen Spitzmueller
143e534d1e Implement reference-to-paragraph in outliner (#1624)
This allows to insert a cross-reference to headings, figures or tables
by right-clicking on the outliner item.

If the item in question does not have a label yet, it is inserted.
2024-07-28 15:59:06 +02:00
Juergen Spitzmueller
3fe99bf6f5 Implement LFUN_REFERENCE_TO_PARAGRAPH
This function checks whether a paragraph (specified by ID) has a label.
If so, it simply inserts a reference to this at cursor position, if
not it inserts a label to that paragraph (pos 0) and then inserts
a reference at cursor position.

Needed to implement #1624 (insert cross references to items that do not
have yet a label)
2024-07-28 15:54:55 +02:00
Juergen Spitzmueller
e3b36208ed Allow DocIterator::paragraphGotoArgument() to return id() without pos()
We need this for the forthcoming reference-to-paragraph function
2024-07-28 15:53:05 +02:00
Juergen Spitzmueller
a303600b54 Implement Paragraph::getLabel()
This function returns the first label (as string) if there is any
2024-07-28 15:52:19 +02:00
Juergen Spitzmueller
181c8ce7c1 re-implement LFUN_REFERENCE_INSERT
this is in preparation of another feature
2024-07-28 10:37:30 +02:00
Juergen Spitzmueller
5c3b788999 amend d4f58c96b5
avoid having to validate the whole buffer just for this information
2024-07-27 13:34:38 +02:00
Juergen Spitzmueller
ca4fc01847 Load geometry after graphics
Newer graphics driver overwrite some (output) page settings otherwise
See https://tex.stackexchange.com/a/384952/19291

Re-fixes #10970
2024-07-27 12:46:12 +02:00
Juergen Spitzmueller
b6d3066ad2 GuiLog: show also log files of additional indices 2024-07-26 18:48:31 +02:00
Juergen Spitzmueller
d4f58c96b5 Add support for multiple indexes in Memoir
As with almost everything, this class bakes its own cake also with
multiple indexes. So we need to account for this to produce
compilable output.

Not very nice, but there you go!
2024-07-26 12:48:12 +02:00
Jean-Marc Lasgouttes
fe1a3b57df Fixup 999fb37e: always run updateMacros when in batch mode
The optimization is useful in GUI mode only, and it turns out that it
creates weird crashes otherwise.

Thanks to Juergen Spitzmuller for the idea.
2024-07-25 18:37:50 +02:00
Juergen Spitzmueller
003bbd3483 Avoid loop in math parsing function 2024-07-25 09:18:01 +02:00
Jean-Marc Lasgouttes
0d50a8417f Do not update statisitics if buffer has not changed
Rely on the newly-introduced Buffer::id() to skip statistics
computation if the id is the same as last time. This will reduce the
annoyance of updates triggering at random times.

Take this occasion to clean code up:

- add 'skip' parameter (true by default) to Statistics::update to indicate
  that the insets that do not produce output should be skipped.

- use a trailing underscrore for private members
2024-07-24 22:38:39 +02:00
Juergen Spitzmueller
823d290036 amend 9291fc465b
XHTML wants LaTeX math, nothing converted to unicode
2024-07-24 21:44:02 +02:00
Jean-Marc Lasgouttes
a042d6a9d2 fix warning 2024-07-24 21:10:22 +02:00
Pavel Sanda
307d59cdb9 Squash gcc warning. 2024-07-24 19:55:05 +02:00
Jean-Marc Lasgouttes
393f65c737 Fixup 6e81f317: cut and paste error 2024-07-24 18:51:35 +02:00
Jean-Marc Lasgouttes
999fb37ebb Do not run updateMacros if the buffer has not changed
Each buffer now has an id which is increased when it is marked dirty
(or when one of its relatives is marked dirty).

This can be a big win since updateMacros is very expensive.
2024-07-24 18:29:43 +02:00
Jean-Marc Lasgouttes
6e81f31722 Rewrite statistics code
The statistics code is known to be very slow, because it relies on
DocIterator to go through the buffer.

This commit introduces a new Statistics class that encapsulates the
main code, along a virtual method Inset::updateStatistics() that
allows to fine-tune how counting is done inset by inset.

This is a faithful bug-for-bug reimplementation.

The new code appears to be 3x faster than the old one.

See bug #12929 for a discussion about statistics update woes.
2024-07-24 18:07:04 +02:00
Jean-Marc Lasgouttes
1186d90edf Do not export the content of InsetMathBoxed as text in MathML
\boxed{} is the only box in LaTeX that contains math. It is amusing
that the example file that we had for ticket #13609 should not have
been a problem since there is no reason to force <mtext> there.
2024-07-23 23:44:58 +02:00
Jean-Marc Lasgouttes
1385f0fddd Fixup 216a6fb348: close <mtext> when quitting text mode
This fixes malformed documents on UserGuide export.

Related to bug #13069.
2024-07-23 22:02:50 +02:00
Jean-Marc Lasgouttes
a268fe096a Fixup 216a6fb3: fix broken xml syntax
This commit addresses two issues:

1/ the embarassing one: the member SetMode::old_text_level_ was
   declared as bool instead of int. This means that is was definitely
   not a proper backup variable!

2/ a robustness issue: replace two consecutive test for isTest() by a
   boolean veriable that is used twice. This makes sure that <mrow>
   cannot be output without the corresponding </mrow>.

Part of bug #13069.
2024-07-23 19:52:12 +02:00
Richard Kimberly Heck
fb919e653d Typo 2024-07-22 16:21:37 -04:00
Jean-Marc Lasgouttes
1cc1f0ba27 Make scrolling-by-selection smoother
This trivial patch makes scrolling-by-selection smoother by dividing
the step size and the time between steps by 8 when generating
synthetic events in work area.

The scrolling speed is unchanged, but the result is visually better.
2024-07-22 22:02:04 +02:00
Jean-Marc Lasgouttes
216a6fb348 Fix crash when generating MathML with InsetMathBox
Instead of generating code and parsing it to add <mtext>...</mtext> at
the right spots, this commit honors the text mode setting that was
already present in the codebase to generate it automatically.

This is the work of two helper methods in MathMLStream:

* beforeText() notices when the stream is in text mode and that a
  <mtext> has not yet been generated. In this case it inserts it, so
  that raw text can be emitted afterwards.

* beforeTag() checks whether a <mtext> needs to be closed at this
  point, and does it if needed.

To make this work, the code now tracks the nesting level in the
stream, and compares it the what the level was when text mode has been
enabled using the SetMode helper function.

In order to avoid later bugs, member os() that allows to access the
underlying stream of MathMLStream is removed. This required many <<
operators to become friends of MathMLStream.

In InsetMathBox, rename splitAndWrapInMText() to mathmlizeHelper(),
which is not just a method that sets text mode inside a <mrow>
element.

In InsetMathFont and InsetMathHull, the explicit generation of nesting
in <mtext>...</mtext> can be removed now.

Fixes bug #13069.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
fbd4b0a13f Cleanup MathMLStream
This is preparatory work for fixing ticket #13069.

Remove direct accesses to the underlying stream of MathMLStream in
InsetMathChar, InsetMathSpecialChar, and in all << operators other
than MathMLStream << docstring. This will allow to add a hook later in
this operator.

Move default values of MathMLStream private members to their definition.

Get rid of line_ member, which is not used.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
d7ba7bceb3 Revert "Fix bug #13069."
This reverts commit fafe3ea5d7.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
cd4d54f76a Revert "Cmake build: Add Qt?Xml modules to build."
This reverts commit 0116048697.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
095bb18331 Remove alpha component of system colors
When using system colors it may happen (on windows 11 in particular)
that the background color is actually translucid. This is not
something we are prepared to handle and it creates ghosts on screen.

The fix is easy: the alpha channel of the colors is set to 255.

Fixes bug #13084.
2024-07-22 20:36:20 +02:00
Juergen Spitzmueller
5bc4c11fd6 tex2lyx: Fix two bugs in nomencl import
* The comment character % is made active to serve as an escape char
* quotation marks need to be escaped
2024-07-22 09:51:54 +02:00
Jean-Marc Lasgouttes
23379bb1d5 Store spellchecker_esc_chars as a docstring
This is a minor optimization to avoid calling from_utf8() repeatedly
on a hot path.
2024-07-21 21:35:14 +02:00
Juergen Spitzmueller
f1ba6559f2 update tex2lyx tests 2024-07-21 18:06:58 +02:00
Juergen Spitzmueller
ae1e1cb069 Add possibility to manually specify longest label in nomenclature
File format change
2024-07-21 17:59:34 +02:00
Juergen Spitzmueller
eb1ac06a9a Consider masked modifiers (~S etc.) when writing to bind file
Fixes #12973
2024-07-21 10:18:58 +02:00
Jean-Marc Lasgouttes
3040eb0fa2 Use background to make math comments more visible 2024-07-20 23:37:24 +02:00
Juergen Spitzmueller
c4001c7022 update comment 2024-07-20 17:47:47 +02:00