Commit Graph

3270 Commits

Author SHA1 Message Date
Richard Kimberly Heck
62af7ee772 More requires --> required, for C++2a. 2020-02-28 00:36:55 -05:00
Stephan Witt
3ee1bcad04 Remove another unnecessary assignment 2020-02-12 12:28:18 +01:00
Enrico Forestieri
926c846abb Remove unnecessary assignments 2020-02-10 21:59:52 +01:00
Enrico Forestieri
536d476d38 Make sure to not dereference a null pointer. 2020-02-10 21:54:07 +01:00
Stephan Witt
59fa0b2592 Fix a crash with uninitialized buffer member of MathData
See the details here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210294.html
2020-02-07 10:17:33 +01:00
Jean-Marc Lasgouttes
a187cbeb64 Rename PainterMetrics::change_ to change
This is not a private variable.
2020-01-14 11:50:44 +01:00
Juergen Spitzmueller
a450797b2a Rest in peace, dvipost! 2020-01-13 08:59:26 +01:00
Jean-Marc Lasgouttes
bf7f4d716c Avoid blinking change tracking cur for math inset.
Since there is a margin above and below the inset, there is no problem
for putting it higher.

Fixes bug #11684.
2020-01-11 13:39:20 +01:00
Juergen Spitzmueller
affc006bae Honor change tracking when automatically renaming refs to labels
Fixes rest of #11556
2019-12-31 12:29:53 +01:00
Juergen Spitzmueller
89b5607e0a Centralize code to markup deleted complex objects (with tikz) in output
This fixes #9293
2019-12-28 13:43:17 +01:00
Juergen Spitzmueller
e5a9d09870 Mark deleted graphics in output
Fixes #11687
2019-12-26 07:15:37 +01:00
Jean-Marc Lasgouttes
49ed5b4626 Add a setBuffer method to InsetArgumentProxy
This is needed to set the buffer of default values of optional arguments.

Fixes bug #11695.
2019-11-15 20:43:00 +01:00
Jean-Marc Lasgouttes
067d6dc759 Mark insets with invalid buffer() in red in devel-mode.
We tend to have insets which buffer() member is invalid. To help
debugging, this commit paints their background in red when devel-mode
is on.

To this end, a new method develMode() is added to the Painter class.

With this commit, it is easy to see that macro template do not have a
proper buffer set!
2019-10-21 17:24:24 +02:00
Jean-Marc Lasgouttes
44816adce6 Be careful before using buffer parameters in colAlign
Make InsetGrid::colAlign a normal method and make it check whether
buffer is valid before using it. This avoids crashes as we have seen
in 2.3.3 (see e.g. #11686).

There is still an assertion so that failure is noticeable before release.
2019-10-21 17:02:39 +02:00
Jean-Marc Lasgouttes
19abf29ea0 Set buffer when expanding macro
This avoids a crash in InsetMathSplit which uses the buffer() value.

Fixes bug #11686.
2019-10-20 12:54:59 +02:00
Enrico Forestieri
0573bf92e0 Fix bug 11667
When automatic command termination was added to texstream it was
forgotten to reset its status after a math inset.
2019-09-28 16:08:06 +02:00
Jean-Marc Lasgouttes
8d080364d2 Clarify calculation precedence for '&' and '?'
Spotted by cppcheck
2019-09-15 23:57:57 +02:00
Jean-Marc Lasgouttes
decd2c74f1 Mark constructors with only one parameter as explicit
Spotted by cppcheck
2019-09-15 23:56:17 +02:00
Jean-Marc Lasgouttes
19fb4db71e Make code more obvious
- use propoer parenthesis
- do not store in variable something we do not use

Spotted by cppcheck.
2019-09-15 23:31:32 +02:00
Jean-Marc Lasgouttes
02d55ab0b3 Avoid useless test
Spotted by cppcheck
2019-09-15 23:30:29 +02:00
Jean-Marc Lasgouttes
b42e6e96d8 Pass variable by reference
Spotted by cppcheck
2019-09-15 23:29:47 +02:00
Jean-Marc Lasgouttes
714113655a Follow some of the performance advice from cppcheck
Most of that is changing string to string const &.
2019-09-13 16:23:49 +02:00
Jean-Marc Lasgouttes
5915d69eaf Set buffer correctly when deleting column in math grid
This is a followup to 837bcbb0.

Fixes bug #11623.
2019-08-28 18:21:17 +02:00
Juergen Spitzmueller
231b36d950 Fix text direction of references with XeTeX/bidi
Fixes: #11626
2019-08-05 16:30:01 +02:00
Jean-Marc Lasgouttes
732395ef1e Add support for amsmath's smallmatrix
This is a tight matrix in script size that is suitable for using inline.

Patch from our own Martin Vermeer and myself.
2019-07-15 13:38:07 +02:00
Jean-Marc Lasgouttes
009e7a61bb Fixup ee0bd36a86: only clear margins when needed
The old code would erase text around inline math.

Related to #11333.
2019-07-15 13:06:09 +02:00
Jean-Marc Lasgouttes
ca5cac2b51 When pasting several cells in mathed, take cursor position in account
Related to bug #11390
2019-07-15 01:20:08 +02:00
Jean-Marc Lasgouttes
ee0bd36a86 Add empty rows to grid insets when numbers are too wide
This is done to ensure that numbering never overlaps equations. The
result can be different according to the bufferview, which is why
RowInfo::offset is now a std:map.

Remaing issues (how bad are theese ?):

- the numbering is considered too large when it overlaps the inset
  rect, whereas one could consider the width if the current row
  instead.

- previews may need to be adapted similarly to fit the whole screen width
2019-07-14 23:27:44 +02:00
Jean-Marc Lasgouttes
dea245d540 Draw display math numbering outside of inset
This is the first (easiest) step in fixing bugs 10668 and 11333.

The numbering is now drawn outside of the insets, which solves the
alignment problems and make editing easier.

What does not work yet:

- long labels will overwrite equations. To fix this, we need to
  implement the same algorithm as LaTeX and put labels on their own
  row when required.

- previews may need to be adapted similarly to fit the whole screen width
2019-07-14 23:27:44 +02:00
Jean-Marc Lasgouttes
ed856c9f4d Make some InsetMathGrid members private
Also remove the trailing underscore of XXXInfo members, since they are
not private in essence.

No intended behavior change.
2019-07-14 17:45:03 +02:00
Jean-Marc Lasgouttes
4cc4663262 Replace MathData::kerning_ member by a function
This allows to make kerning depend on the BufferView? This is not
useful right now, but may become useful for multimonotor setting with
different dpi.
2019-07-14 14:45:36 +02:00
Jean-Marc Lasgouttes
5a22b2e391 Fixup 17571104: really avoid empty numbers in toc
For some reason, I missed this one when trying to fix the bug.

Fixes bug #11423.
2019-07-01 12:05:31 +02:00
Isaac Oscar Gariano
4c587fb9da Make autocorrect have priority.
Place autocorrect at the top of `InsetMathNest::interpretChar`,
ensuring that any autocorrections that trigger on special characters
(such as '^' or '~') work. In particular, you can now make an
autocorrection from "<~" to "\preceq"!
2019-06-25 12:27:28 +02:00
Jean-Marc Lasgouttes
2b1515a936 Rename LM_ST_* to *_STYLE and FONT_SIZE_* to *_SIZE
This makes code more uniform. This is typically something that is done
at end of cycle to limit backport issues later.
2019-06-14 17:05:49 +02:00
Jean-Marc Lasgouttes
f12e796999 Revert "Rename LM_TC_* to FONT_STYLE_*"
Got it wrong, revert for now.

This reverts commit 67215833a1.
2019-06-14 17:05:00 +02:00
Jean-Marc Lasgouttes
67215833a1 Rename LM_TC_* to FONT_STYLE_*
This makes code more uniform. This is typically something that is done
at end of cycle to limit backport issues later.
2019-06-14 16:42:02 +02:00
Enrico Forestieri
1cb2a443b5 Fix bug #11595
Avoid an endless loop when in the definition of a macro the macro
itself is used in the LyX representation part.
2019-06-09 22:36:59 +02:00
Jean-Marc Lasgouttes
d02244c8fb Make caret visible inside math macros arguments
The first step is to move the MathRow cache to BufferView, alongside
coordCache. This was on the todo list anyway, since it allows to let
go the math row information when the math equation is not on the
screen anymore. With the old scheme, it would always remain in memory.

Then, when computing caret size in MathData::metrics, make sure that
the mathrow of the elements that are linearized in the MathRow object
get their caret size information initialized too.

Fixes bug #11587.
2019-06-03 16:28:16 +02:00
Isaac
3519be2292 Removed shortcuts to toggle autocorrect.
They are not really needed now that autocorrection can be undone. This
increases autocorrect usability.
2019-06-03 11:09:09 +02:00
Jean-Marc Lasgouttes
64396717db Allow to undo partly math autocorrect
To this end, introduce Undo::splitUndoGroup, which ends currently
group and creates a new one with same nesting level.
2019-06-02 21:17:26 +02:00
Isaac
bed546d6f6 Make math autocorrrect work with more than 2 chars
Currently, math autocorrect allows to transform a couple of characters
to a new one. This patch allows to transform a couple (sequence,
character) to a new character.

No example are implemented right now. One possible idea would be
"--" + ">" => \longrightarrow
2019-06-02 21:12:12 +02:00
Enrico Forestieri
b3db2325ed Prefer mathmode commands over textmode ones
Translating → to \rightarrow in a \ce inset produces the right
glyph. Instead, translating it to \textrightarrow produces a
different glyph (β).
2019-05-26 13:06:44 +02:00
Enrico Forestieri
c8f056417f Use ranges 2019-05-26 12:31:02 +02:00
Enrico Forestieri
15f4fa452d Supplement the fix for bug #11586
The mhchem \ce inset is a text mode environment but allows entering
spaces and mathmode commands. However, even if it doesn't allow unicode
symbols, LyX allows entering them (by copy/paste, for example), causing
latex errors. As a unicode symbol may have a proper latex representation
from the unicodesymbols file, use it instead of the bare symbol. Here, we
don't care about the mode because both text and math mode should be allowed.
For example, the ⟶ symbol is not recognized but its latex representation
(\longrightarrow) is fine. Of course, there may be symbols that are
not recognized anyway, but this is better because they cause explicit
errors from mhchem instead of cryptic iconv errors in case they cannot
be represented in the document encoding.
2019-05-26 09:56:34 +02:00
Enrico Forestieri
bda3b799c5 Partial fix for bug #11586
Do not replace a latex command with the corresponding symbol
in the unicodesymbols file unless it can be encoded in the
document encoding.
2019-05-26 09:27:46 +02:00
Jean-Marc Lasgouttes
4da19ef833 Cell in delimiter inset should not be tight
Fixes bug #11337.
2019-05-25 14:11:39 +02:00
Enrico Forestieri
1a286c7910 Fix bug #10499
The array environment has to be explicitly parsed in math mode.
2019-05-18 11:36:07 +02:00
Jean-Marc Lasgouttes
175711046d Newly created inline math is not numbered
The bad initialisation created phantom entries in equation ToC

Fixes bug #11423.
2019-05-11 23:18:10 +02:00
Enrico Forestieri
2731c5dc55 Correctly protect macros with optionals inserted in an optional argument
The trick turns out to be inserting in braces the whole optional
argument, rather than the single macro.

See #11552 for the long history.
2019-04-26 15:30:08 +02:00
Enrico Forestieri
e763f90244 Revert [60ac25a4/lyxgit], [30f16463/lyxgit], and part of [e8f480e7/lyxgit]
As evidenced in #11552, at loading time there is no way to tell
whether braces were added by LyX with certainty. However, after
[503f7db2/lyxgit], LyX does not automatically removes brace insets.
So, in case one faces the problems mentioned in [e8f480e7/lyxgit],
the workaround of adding a brace inset now will not be frustrated.
In essence, after [503f7db2/lyxgit], the real fix for #11552 would
have been reverting the part in [e8f480e7/lyxgit] that was adding
the braces on output.
2019-04-26 12:34:29 +02:00