Commit Graph

3611 Commits

Author SHA1 Message Date
Enrico Forestieri
bdaad03a45 Do not accumulate underline changes
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}}".
2023-11-08 09:17:38 +01:00
Enrico Forestieri
ea30f1feb1 Amend 58103cf2
Give a variable a more meaningful name and fix a typo.
2023-11-08 08:56:40 +01:00
Enrico Forestieri
f8f2355445 Silence compiler warning 2023-11-06 21:03:23 +01:00
Enrico Forestieri
9d95147528 Amend 58103cf2
Correct file name.
2023-11-06 18:46:22 +01:00
Enrico Forestieri
58103cf214 Allow using the text properties dialog in mathed
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
2023-11-06 18:04:44 +01:00
Enrico Forestieri
75a08df529 Inherit outer font in text-in-math environments
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.
2023-11-02 17:54:02 +01:00
Enrico Forestieri
e0e1350b7e Revert "Inherit outer font in text-in-math environments"
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.
2023-11-02 01:59:54 +01:00
Enrico Forestieri
d72b9b0238 Inherit outer font in text-in-math environments
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.
2023-11-01 22:21:49 +01:00
Pavel Sanda
28f81d1be5 Revert "MathML: don't output delimiters in InsetMathBinom and InsetMathDelim if the delimiter is a space."
This reverts commit be44cb8516, see #12891.
2023-10-27 21:18:45 +02:00
Jean-Marc Lasgouttes
99ecdd6ceb Fixup 65cb9fa4: avoid extra spacing when selecting math
This was happening whenever a selection started/ended after a fraction
inset.
2023-10-18 12:30:55 +02:00
Jean-Marc Lasgouttes
ff7696f184 Do not use Color_selectionmath when selection is gone
It might happen that the selection goes away without recomputing
metrics (for example with char-forward). The added test is a bit of a
band-aid for this situation. A better solution would be to understand
better when metrics computation is triggered in mathed.
2023-10-12 11:30:47 +02:00
Jean-Marc Lasgouttes
174dc2c8be Use Color_selectionmath as needed for multi-cell selection in math
This is complementary to partial selection implemented at 65cb9fa4.
2023-10-12 11:30:47 +02:00
Thibaut Cuvelier
be44cb8516 MathML: don't output delimiters in InsetMathBinom and InsetMathDelim if the delimiter is a space. 2023-10-11 20:37:38 +02:00
Juergen Spitzmueller
5cb53606b6 Introduce color_selectionmath
To have a distinctive color for selected math which works in both modes

Also, link color_selectionmath with QPalette::HighlightedText, so we
won't need to special-case on lyxrc.use_system_colors any longer
2023-10-04 13:10:07 +02:00
Jean-Marc Lasgouttes
65cb9fa4df Use Color_selectiontext as needed for partial selection in math
Currently, selected math hull insets use Color_selectiontext when
system colors are in use. This commit implements the same behavior
for partial selection.

This is done by introducing two element types (BEGIN_SEL and END_SEL)
to MathRow.
2023-10-03 12:51:11 +02:00
Jean-Marc Lasgouttes
9156712895 Make sure that caret width is not null in mathed
The same test exists in texted.

Fixes bug #12904.
2023-09-24 13:07:55 +02:00
Jean-Marc Lasgouttes
94c6d45b74 When drawing macro names, enforce LtR direction
Add a Direction parameter to the Painter::text methods that take a
FontInfo parameter.

In drawStrRed and drawStrBlack, force the direction to LtR.

Fixes bug #12905.
2023-09-22 12:41:44 +02:00
Alexander Dunlap
ca3004fc67 Assign equation numbers in updateBuffer instead of
addToToc so that they can be used in updateToc to
assign label cross-refs
2023-08-24 21:14:53 -04:00
Richard Kimberly Heck
89a479f60d Fix bug #12797.
Use plaintext to give some display of equations in TOC.
2023-08-24 21:05:50 -04:00
Enrico Forestieri
4fa0fbe5bf Use utf8 strings for previewed labels when possible
Fixes bug #12842.
2023-08-10 18:34:17 +02:00
Richard Kimberly Heck
7fb3773e60 Fix up 04fc48d790. 2023-07-29 13:53:59 -04:00
Pavel Sanda
56d9b713c7 Save translators time, already used on different places. 2023-07-27 23:24:11 +02:00
Thibaut Cuvelier
98d1b04160 Before this patch, each character within InsetMathClass was output separately, without understanding their meaning, using the default text output (with [] around each character). This commit changes the behaviour to skip the InsetMathClass during the MathML output. This effectively renders the inset useless for MathML (instead of controlling spacing), as expected, because the MathML processor is supposed to handle the spacing itself.
Another implementation would have been to use the lspace and rspace attributes in MathML, but they require to give the exact spacing before and after the operator instead of relying on rules like TeX.

For instance, `$a\mathbin{+}b$` resulted in this MathML output before the patch:

```
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
 <mi>a</mi><!--  -->
 <mi>[mathbin [char + mathalpha]]</mi>
 <mi>b</mi>
</mrow>
</math>
```

For comparison, this was the output with LyX 2.3.7

```
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow>
  <mrow><mi>a</mi><!--  -->
   <mi>[mathbin [char + mathalpha]]
   </mi><mi>b</mi>
  </mrow>
 </mrow></math>
 ```

 After this patch, it looks like:

 ```
 <math xmlns='http://www.w3.org/1998/Math/MathML'>
 <mstyle class='math'>
  <mrow>
   <mi>a</mi>
   <mo>+</mo>
   <mi>b</mi>
  </mrow>
 </mstyle>
 </math>
 ```
2023-07-27 01:22:30 -04:00
Alexander Dunlap
c609e9cbcf Display equation/theorem numbers in insert cross reference dialog.
Fixes bug #11466,
2023-07-26 13:35:42 -04:00
Jean-Marc Lasgouttes
0f7404392c Fix issues with inset-dissolve in mathed
* do not try to dissolve a macro template inset (avoids a crash)
* disable inset-dissolve when an argument is given
* when triggered by the AtPoint mechanism, make sur to dissolve the
  right inset.

Fixes bug #12562.
2023-07-23 17:39:39 +02:00
Jean-Marc Lasgouttes
62d61e7655 Revert "Fix crash when dissolving a top level math inset"
The code was too convoluted and actually wrong (the -1 should have been -2).

This reverts commit c75522bbb7.
2023-07-23 17:38:47 +02:00
Juergen Spitzmueller
999b95398d THINSPACE is nonbreakable (i.e., 0x202f, not 0x2009) 2023-07-17 17:14:50 +02:00
Jean-Marc Lasgouttes
d8e509e5eb Cleanup and (maybe) speedup InsetMathChar::mathClass
Profiling with hotspot show that it counts for more than it should and
indeed using support::contains is a overkill here. I like the new code
better anyway.

I would be surprised to see that it makes a big difference, though.
2023-07-15 23:29:24 +02:00
Jean-Marc Lasgouttes
4bbd4a45e7 Fix display of a math hull inset in a tight inset
This is a kind of hack. This allows InsetMathHull to state that it
needs some elbow room beyond its width, in order to fit the numbering
and/or the left margin (with left alignment), which are outside of the
inset itself.

To this end, InsetMathHull::metrics() sets a value in
MetricsInfo::extrawidth and this value is recorded later in the
corresponding row element's `extra' field.

The code could be reorganized to be simpler, in particular by
computing metrics in tokenizeRow, or after tokenizeRow. However the
choice here is to produce a simple patch, fit for 2.4.0.

Fixes bug #12320.
2023-07-14 17:17:23 +02:00
Enrico Forestieri
befe2da495 Honor pending spaces in InsetMathChar::write
The InsetMathChar::write() method directly accesses the otexrowstream
underlying the TeXMathStream class for writing a character, thus
shortcircuiting the mechanism that allows to separate a macro from the
following material. It has to do so because directly writing a char_type
would cause printing its numerical value instead of the corresponding
unicode character in systems where char_type is typedef'd to uint32_t.

This problem has been uncovered by [7441172d/lyxgit] because each atom
of a mathed cell was being separately written to the output instead of
using the lyx::write() method in MathExtern.cpp that simply converts
everything to a docstring. As InsetMathChar::write() is the only method
bypassing the TeXMathStream machanism, it is simpler teaching it to
honor the pending space instead of modifying the code in InsetMathColor.

This commit amends 7441172d.
2023-06-28 21:17:26 +02:00
Scott Kostyshak
eac460e438 Remove the mathed "BUGS" file (#3493)
Jürgen cleaned up the previous contents of this "BUGS" file. What
was left (before the rm in this commit) had been written in 2001 at
2dd1a460, and it is not clear if it is still relevant.
2023-06-15 05:15:32 -04:00
Richard Kimberly Heck
0c69a5eab2 Fix bug #12796 2023-06-12 19:38:40 -04:00
Enrico Forestieri
c33f2f50a0 Do not output LaTeX for a macro if the LaTeX part is empty. 2023-06-11 12:55:51 -04:00
Jean-Marc Lasgouttes
f7afcc31fe Fix undo with cell-plit
This function modifies several cells.

Fixes bug #12746.
2023-04-21 14:42:51 +02:00
Juergen Spitzmueller
a15bc829d1 Do not load mathrsfs if unicode-math is required (#12734)
The latter provides \mathscr and the packages clash
2023-04-15 12:35:22 +02:00
Juergen Spitzmueller
e9c8b10c1d Do not forceLTR math with Xe/Lua (part of #12731) 2023-04-10 08:24:46 +02:00
Scott Kostyshak
83af3dfd29 Fix equation numbers after row operation (#12665)
After removing/adding rows, the corresponding equation numbers in
the LyX display were not updated (although if you clicked outside
the math inset they were).

Now they are updated immediately after the operation.
2023-02-22 11:12:56 -05:00
Jean-Marc Lasgouttes
ab8ea2543d Revert "Fixup 0cbe0d7a: avoid double redraw when completion is finished"
This is my 635th lesson that trying to be too clever is not that good.
This change interferes with the yet-to-come fix to #12674.

This reverts commit cc6dae1363.
2023-02-22 12:00:14 +01:00
Jean-Marc Lasgouttes
cc6dae1363 Fixup 0cbe0d7a: avoid double redraw when completion is finished 2023-02-22 11:32:11 +01:00
Jean-Marc Lasgouttes
0cbe0d7a3e Make sure that screen is updated when completing math
There was a missing update there.

Fixes part of bug #12674.
2023-02-22 11:23:10 +01:00
Enrico Forestieri
07150cd928 Amend 16e67d4e
A docstring is not 0-terminated...
2023-01-27 21:10:02 +01:00
Enrico Forestieri
16e67d4ebb Fix bug #12633
Avoid recursion when validating a macro that is defined recursively.
This avoids a crash but the latex engine will choke on it, of course.
2023-01-27 20:34:24 +01:00
Thibaut Cuvelier
fca8e54289 InsetMathHull: add a missing const (plus strange indentation fixed). 2023-01-22 02:45:25 +01:00
Thibaut Cuvelier
d066a66a51 MathML: make InsetMathHull::mathmlize easier to read while doing less work
If `havetable == true`, a lot of the code didn't make any sense: in particular, it was outputting a level of <m:mrow> too many.

Also, add some comments and rewrite the comment about mlabeledtr.

Contributed by lynx: https://www.lyx.org/trac/ticket/12629
2023-01-22 01:49:03 +01:00
Thibaut Cuvelier
e7d57338b9 InsetMathHull: replace 0 by nullptr. 2023-01-22 01:25:03 +01:00
Thibaut Cuvelier
bf0da33c9a MathML: use standard {M/E}Tag{,Inline} instead of bespoke constructs
Also, replace lspace='thinmathspace' by constructs that are not deprecated.

Contributed by lynx: https://www.lyx.org/trac/ticket/12629
2023-01-20 02:56:55 +01:00
Thibaut Cuvelier
598c6a0a87 MathML in HTML: in case of conversion failure, add a comment 2023-01-20 02:45:35 +01:00
Thibaut Cuvelier
f9fd652aae MathML: improve formatting of formula in XHTML hull
Contributed by lynx: https://www.lyx.org/trac/ticket/12629
2023-01-20 02:45:35 +01:00
Thibaut Cuvelier
0c227d3dfa MathML: remove extraneous <mrow> in fractions
Contributed by lynx: https://www.lyx.org/trac/ticket/12629
2023-01-20 02:30:43 +01:00
Thibaut Cuvelier
66fab70388 MathML: replace HTML entities with XML ones in more places
This part should have been committed with bc73a857 in the first place.
2023-01-20 02:25:37 +01:00
Thibaut Cuvelier
5f7c26fbe5 MathML: remove useless code
Contributed by lynx: https://www.lyx.org/trac/ticket/12629
2023-01-20 02:19:33 +01:00
Jean-Marc Lasgouttes
6093e7d661 Fix warning
This was:
../../master/src/mathed/InsetMathBox.cpp:116:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::__cxx11::basic_string<wchar_t> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  116 |  for (int i = 0; i < parts.size(); i += 2) {
      |                  ~~^~~~~~~~~~~~~~
../../master/src/mathed/InsetMathBox.cpp:120:20: warning: comparison of integer expressions of different signedness: ‘std::vector<std::__cxx11::basic_string<wchar_t> >::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
2023-01-09 16:06:38 +01:00
Thibaut Cuvelier
1b09bc965d InsetMathBox: remove debugging code. 2023-01-09 01:11:52 +01:00
Thibaut Cuvelier
e70cdfd3a2 InsetMathBox: split the boxed text into <mtext> and other tags, while boxing the whole inset within an <mrow>.
Rationales:
- previously, <mstyle> was used, but it's being deprecated for MathML 4 Core in favour of CSS and <mrow> (not a big deal in itself)
- the whole box cannot be hosted within the same tag, because neither <mstyle> nor <mrow> can have text, they need an intermediate container, <mtext> (which cannot hold anything else that pure text)
- new behaviour: always output a container for the whole box that has the right attributes, i.e. an <mrow>; split the content of the cell to have text and other tags set apart (text in <mtext>, other tags left as they were)

Old behaviour, invalid MathML (2 to 4):
<mstyle XXX>text<mn>.</mn></mstyle>

New behaviour, valid MathML:
<mrow XXX><mtext>text</mtext><mn>.</mn></mrow>
2023-01-08 02:36:48 +01:00
Thibaut Cuvelier
d3c81eb2cb InsetMathBox: fix strange indentation (mix of spaces and tabs). 2023-01-08 00:51:43 +01:00
Thibaut Cuvelier
edcaad2419 MathML: convert InsetMathBox as <m:mtext>.
The inset represents text (as opposed to maths in formulae). <m:mstyle> is used to give style to its children, it is not supposed to have any contents on its own.
2023-01-08 00:50:29 +01:00
Richard Kimberly Heck
04025d0259 Fix compilation problem 2023-01-04 23:04:02 -05:00
Thibaut Cuvelier
3839897c0f InsetMathExFunc: use XML entities instead of HTML in MathML.
This part should have been committed with bc73a857 in the first place.
2022-12-26 20:38:06 +01:00
Thibaut Cuvelier
9b80a5ba9e InsetMathSpace: use XML entities instead of HTML in MathML.
This part should have been committed with bc73a857 in the first place.
2022-12-26 20:35:26 +01:00
Thibaut Cuvelier
c77872f314 Cleanup following the removal of HTML entities
The remaining part that was not handled in the previous commit. It focuses on lib/symbols.
2022-12-25 20:48:14 +01:00
Thibaut Cuvelier
bc73a85778 LyXHTML: switch the doctype to (X)HTML5 and only output XML entities.
This is a new take on c8e2c17a that was reverted at da67bde61a due to entities no more recognised by the browsers. Corresponding thread on the mailing list: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg213179.html

This patch is a huge cleanup overall, by removing the distinction between HTML and XML entities (the latter arrived due to the DocBook support).

In InsetListingParams, I also changed the mechanism that relied on &quot; to use an XML entity to be consistent with the rest of the code, mostly in case someone looks for HTML entities and wonders why they are still there.
2022-12-25 20:48:14 +01:00
Juergen Spitzmueller
029adfa28c Improve LaTeX version checking
Instead of having to add and individually test the versions to check
for, we store the current version and test on that with a specific
function isAvailableAtLeastFrom(package, year, month, day)

Currently only used for the LaTeX version, but could also be extended
for package versions.
2022-12-19 15:15:41 +01:00
Juergen Spitzmueller
005dc32e54 Disable non-functional insets in math (#4039)
... finishing 15 year old work of mine :-(
2022-12-18 15:12:21 +01:00
Thibaut Cuvelier
6c22e32cee MathML: update code for InsetMathCases to newest classes.
Based on a commit from lynx <lorenzobertini97@gmail.com>

Part of bug #12590.
2022-12-09 01:49:19 +01:00
Thibaut Cuvelier
5893ea866e MathML: output substacks as grids.
Based on a commit from lynx <lorenzobertini97@gmail.com>

Part of bug #12590.
2022-12-09 01:48:14 +01:00
Juergen Spitzmueller
c715db4ae8 Amend 14b108fc22 2022-12-05 08:20:25 +01:00
Juergen Spitzmueller
7a0c8f366d Typo spotted by Pavel 2022-12-05 06:47:52 +01:00
Jean-Marc Lasgouttes
ff1ddf6251 Fixup 71623b88: change semantics of "delete" LFUNs again
Instead of specifying "force" to disable the deletion protection
mechanism, invert the default so that "confirm" is needed to activate
it. The idea is to keep the lfun reasonable for scripting and add a
special argument for interactive use.

Document in release notes.

Update LFUN.lyx documentation

Update bind files.

Add conversion step to prefs2prefs_lfun.py.
2022-12-04 21:13:51 +01:00
Juergen Spitzmueller
14b108fc22 Check encodability of math user macro names (#11855) 2022-12-02 11:23:32 +01:00
Juergen Spitzmueller
ac58a5060e Revert e500dc19c1
More general fix is upcoming.
2022-12-02 11:21:15 +01:00
Juergen Spitzmueller
e500dc19c1 Do not crash with uncodable character in math preview snippert (part of #11855) 2022-12-01 16:01:38 +01:00
Juergen Spitzmueller
f155e103d3 Cleanup mathes/BUGS (#3493)
This one is now also part of #12603.
2022-11-22 10:18:43 +01:00
Juergen Spitzmueller
1383276156 Cleanup mathes/BUGS (#3493)
This one is now #12603.
2022-11-22 10:16:29 +01:00
Juergen Spitzmueller
73156d88f2 Cleanup mathes/BUGS (#3493)
Removing. If this is still an issue, it should be described in much
more detail.
2022-11-22 10:12:06 +01:00
Juergen Spitzmueller
26f6aa465e Cleanup mathes/BUGS (#3493)
Removing. M-c e has a different meaning nowadays
(tabular-feature delete-vline-left)

Please file a new report with an updated description if this is still
an issue.
2022-11-22 10:09:16 +01:00
Juergen Spitzmueller
1d6ea2c711 Cleanup mathes/BUGS (#3493)
This one is now #12602.

Someone please check whether this is valid, and feel free to close.
2022-11-22 10:03:25 +01:00
Juergen Spitzmueller
b77b9d1565 Start to cleanup mathes/BUGS (#3493)
This one is implemented.
2022-11-22 09:59:01 +01:00
Enrico Forestieri
1ac2dc2082 Do not allow nesting macro names in macro names
LyX removes a single backslash when it is inserted in a
macro name by the keyboard. However if it is followed by
another character before moving the cursor, it is retained
causing an assertion (bug #12601).
2022-11-21 18:24:29 +01:00
Jean-Marc Lasgouttes
593bfe248a Substack should not be allowed to change columns
Disable the arguments append-column and delete-column of tabular-features.

The code is taken from InsetMathCases, with some changes
* no need to record undo here
* in dispatch, return is prefered to break, since we do not want to invoke
  InsetMathGrid::doDispatch.
Propagate these changes to InsetMathCases.

Cleanup of the InsetMathCases error messages to fit with other parts
of the code.

The handling of tabular-features in mathed needs to be unified somehow.

Based on a commit from lynx <lorenzobertini97@gmail.com>

Part of bug #12590.
2022-11-21 12:08:17 +01:00
Enrico Forestieri
a11780b59f Do not allow pasting backslashes in macro names
Backslashes are not allowed in macro names and LyX
enforces this by not allowing entering them by keyboard.
However, it was possible to paste them and this may cause
crashes (see bug #12596).
2022-11-20 19:01:38 +01:00
Jean-Marc Lasgouttes
49fee942cf Fix inline completion prefix for macro insets
As it was, the prefix was empty when completion popups were disabled.

Related to bug #12581.
2022-10-08 14:22:18 +02:00
Jean-Marc Lasgouttes
786a6edb54 Disable completion when document is read-only.
Being able to insert completion in a read-only document is definitely
a bad idea.

This patch acts both on indication of completion and on insertion
itself.

Fixes bug #12582.
2022-10-08 12:52:05 +02:00
Jean-Marc Lasgouttes
8508c3fe04 Completion: handle undo in insets' insertCompletion methods
I mathed, undo should record the underlying inset on completion,
whereas in test recording the paragraph is enough.

Therefore the recordUndo() in GuiCompleter::tab is removed, and the
relevant recordUndo/recordUndoInset are used at the right places.

As a further cleanup, the parameter `finished' of
Text::insertCompletion is removed as it is useless.

Fixes bug #12581.
2022-10-05 09:48:01 +02:00
Enrico Forestieri
65b4c3fcd2 Fix bug #12580
This amends [4a7a1935/lyxgit]. Before 4a7a1935 it was assumed
that a labeled row was also numbered. Hence, when unnumbering
a row a label was also deleted. We now have to do this explicitly.
2022-10-02 14:59:03 +02:00
Thibaut Cuvelier
0bda6950e4 MathML: amend 26300c565f as discussed in bug 12513
Contributed by lynx
2022-09-02 02:00:12 +02:00
Thibaut Cuvelier
5b405426f1 MathML: should display "Text" MathFont using proper <mtext> tag
Fixes bug 12397

Contributed by lynx
2022-09-02 01:57:06 +02:00
Juergen Spitzmueller
f6fff878a7 fix compiler warning 2022-08-16 17:41:40 +02:00
Scott Kostyshak
11d5e31c65 Remove unneeded code
This code was triggering the following warnings:

  src/mathed/InsetMathHull.cpp:234:15: error: variable 'counters_to_save' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
          const char * counters_to_save[] = {"section", "chapter"};
                       ^
  src/mathed/InsetMathHull.cpp:235:21: error: unused variable 'numcnts' [-Werror,-Wunused-const-variable]
          unsigned int const numcnts = sizeof(counters_to_save)/sizeof(char *);

The original code was put in at 645f9fdf (and the comment at 8a226ec4).

This commit amends a65e12d6.
2022-07-27 07:29:11 -04:00
Jean-Marc Lasgouttes
20d5851fb7 Regenerate equations previews when their numbering changes.
Time will tell whether this is too expensive (because most equations
after this on will change too, unless equations are numbered by
section).

Related to bug #11535.
2022-07-26 23:16:41 +02:00
Jean-Marc Lasgouttes
a65e12d6f3 Reimplement support for numbering of equation previews
This patch simplifies and fixes the generation of previews with
numbering. Instead of saving the counter values (which is complicated
and error prone), the \thequation macro is set to the numbers_ string
which has been computed by updateBuffer for screen display.

Harcoding the number in the formula means that two equations with
different numbers have different previews, which is the subject of the
bug.

The special code for saving counters in updateBuffer and outputing
them in preparePreview from 645f9fdf (ticket #6894) is removed and
replaced by this simpler approach.

This fixes ticket #11535.
2022-07-26 22:47:53 +02:00
Jean-Marc Lasgouttes
a42f7ea7cd Rename eolString() to eol() and pass a MathTeXStream parameter
This is completely equivalent, but will allow in eol() to determine
whether one is preparing a preview.

Related to bug #11535.
2022-07-26 22:21:44 +02:00
Jean-Marc Lasgouttes
1fc08f57e1 Revert "Rename eolString() to eol() ans pass a MathTeXStream parameter"
This reverts commit 2db682b97e.
2022-07-26 00:46:13 +02:00
Jean-Marc Lasgouttes
7261fa9448 Revert "Reimplement support for numbering of equation previews"
This reverts commit f4da29306f.
2022-07-26 00:45:57 +02:00
Jean-Marc Lasgouttes
f4da29306f Reimplement support for numbering of equation previews
This patch simplifies and fixes the generation of previews with
numbering. Instead of saving the counter values (which is complicated
and error prone), the \thequation macro is set to the numbers_ string
which has been computed by updateBuffer for screen display.

Harcoding the number in the formula means that two equations with
different numbers have different previews, which is the subject of the
bug.

The special code for saving counters in updateBuffer and putputing
them in preparePreview from 645f9fdf (ticket #6894) is removed and
replaced by this simpler approach.

This fixes ticket #11535.
2022-07-26 00:19:20 +02:00
Jean-Marc Lasgouttes
2db682b97e Rename eolString() to eol() ans pass a MathTeXStream parameter
This is completely equivalent, but will allow in eol() to determine
whether one is preparing a preview.

Related to bug #11535.
2022-07-26 00:19:07 +02:00
Jean-Marc Lasgouttes
2203078111 Fix flicker due to changing metrics while selecting with the mouse
This patch has been backported from the lyx-unstable branch
https://gitlab.com/gadmm/lyx-unstable/-/commit/9d7ed42389ba

Actual author is Guillaume Munch.

Fixes bug #8951.
2022-07-25 23:04:08 +02:00
Enrico Forestieri
4a7a19352c Fix bug #12561
In mathed it is assumed that a labeled line is also implicitly numbered.
However, latex allows to label an equation without numbering it.
The label is then assigned the value of a nearby numbered one.
This commit drops the above mathed assumption in order to allow to import
valid latex code with a labeled but not numbered equation line.

The screen representation omits the line number and encloses the label
in square brackets for further differentiation. However, it is still not
possible to label an equation without numbering it using the GUI.
2022-07-13 19:11:03 +02:00
Jean-Marc Lasgouttes
c75522bbb7 Fix crash when dissolving a top level math inset
This should be disabled not only for math hull, but also macro template.

Fixes bug #12562.
2022-06-29 22:52:16 +02:00
Enrico Forestieri
0aad230154 Always validate a macro definition
If a user-defined macro appears only in the argument of another
macro its definition is not validated and this leads to errors.

Fixes bug #12524.
2022-05-31 22:17:14 +02:00
Kornel Benko
62ab563c25 FindAdv: Use private variable for_search
Using the new inline statements
	find_effective(), find_with_non_output(), find_with_deleted(),
	find_set_feature(), find_add_feature() and find_clean_features()
makes the code a slightly better readable.
2022-05-09 22:11:38 +02:00