This new warning in gcc 13 is annoying because it happens in certain
parts of our code where it is harmless to pass a temporary variable to
a function that returns a reference.
This patch introduces a new pair of macros,
LYX_BEGIN_MUTE_GCC_WARNING(warn) and LYX_END_MUTE_GCC_WARNING, which
can be used to define a block of code where a given GCC warning is disabled.
The macros are no-ops with compilers other than gcc, although some
compilers that pretend to be GCC make be mis-detected. The worse that
can happen AFAIU is a bunch of warnings.
The macro relies on an intimidating set of for nested macros. The goal
of these macros is to build a nested string bit by bit. Here is how it
works:
PRAGMA_IGNORE(dangling-reference)
=> PRAGMA_IGNORE_1(-Wdangling-reference)
=> PRAGMA_IGNORE_2("-Wdangling-reference")
=> PRAGMA_IGNORE_3(GCC diagnostic ignored "-Wdangling-reference")
=> _Pragma("GCC diagnostic ignored \""-Wdangling-reference\"")
The next question is: what is _Pragma() good for? Well, it is a
version of #pragma that can be used in a macro.
And finally, what are those pragmas good for? The 'push' and 'pop'
ones make changes to warnings local. The 'ignored' ones allow
to disable some warnings. And disabling -Wpragmas ensures that we do
not have a warning if we try to disable a warning that is not
supported by the compiler.
The \underbar macro is a text mode macro that can also be used
in math mode. However, when inserting it in mathed, LyX helpfully
wraps it in a \text inset. One can dissolve such text inset and
the macro would appear in math mode without any problem. But the
output routine thinks that the user is shooting itself in the
foot and tries to protect him by wrapping \underbar in the
\lyxmathsym macro, whose definition is normally added to the
preamble when an unicode character is used in math mode.
Of course, this is not the case for \underbar and a compile
error arises. The easier solution is to simply add lyxmathsym as
a requirement for \underbar in lib/symbols, but this means
that the definition of \lyxmathsym would be added even when not
necessary (because in the validation routine we miss the info
about the current mode). The correct solution is acknowledging
the dual nature of \underbar as a text-mode macro that can also
be used in math mode. Luckily the correct solution is almost as
easy as the easier one and is what is done in this commit.
Separate mangled-name tables for xhtml and latex exports.
LaTeX route should stay as it were (counter+mangled path within filenames in
temp directory)
xHTML route uses hash of path + filename only. We won't use counters because
(unlike in LaTeX export) they stay visible in final export directory and
generally change across LyX sessions.
Hash is short with collision handling because path-length limits of Windows.
cf https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg220582.html
This is only needed for very old versions of the nomencl package
(before March 2005)
No need to output compatibility code with newer versions
Furthermore, this breaks the use of the glossary package which also
has .glo extension (#12968)
If an element is underlined in mathed by using the text properties
dialog, the changes accumulate. So, for example, to change a single
underline to a double one, one would need removing the previous
underline first. This commit allows using the text properties
dialog and simply replace an underline type with another one.
However, this works only if the underlined element is not included
in some other inset. For example, given "\uline{\text{abc}}",
selecting the 'b' and choosing a double underline produces
"\uline{\text{a\uuline{b}c}}". But, given "\text{\uline{abc}}", and
operating as before produces "\text{\uline{a}\uuline{b}\uline{c}}".
This change forces metrics computation in all cases when cursor enters
a math inset from above/below, but I do not have a better idea right now.
Fixes bug #12952.
Until now only the color of the text could be changed by using
the text properties dialog. This commit allows changing all
other properties except for strikethrough. It is possible to
also add underlining with the limitation that the changes
accumulate. This requires other work but I think that underlining
and strikethrough are not so important in mathed and can be
refined at a later time.
Fixes#12958
The proper way to do word-wise selection is to compute the words
around both the cursor and the anchor.
Note that code is uglier than it should because CursorData::normalAnchor()
returns a CursorSlice instead of a DocIterator.
Fixes bug #12533.
Some text-in-math environments such as \text, \mbox, \fbox, and
\makebox, inherit the outer text font. This commit reflects this
in the on-screen representation.
Fixes#12950.
This reverts commit d72b9b0238.
Unfortunately, the font taken into account is the font at the
current cursor position rather than the font of the corresponding
math inset.
The text-in-math environments such as \text, \mbox, \fbox, \makebox
and so on, inherit the outer text font. This commit reflects this
in the on-screen representation.
Fixes#12950.
When setting halfline parskip with parskip provided, we still need
to set this explicitly, as we don't know the current \parskip value.
Also improve code readability.