Commit Graph

3521 Commits

Author SHA1 Message Date
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