Commit Graph

3217 Commits

Author SHA1 Message Date
Juergen Spitzmueller
3663f9d0db Some more 0 > nullptr substitutions 2019-04-21 15:49:11 +02:00
Enrico Forestieri
54147a7140 Fix #11552 in a different way
The reported issue is fixed in a different way, not
involving the fix for #9348.

This commit supercedes [f2029fb3/lyxgit] and [17abf68b/lyxgit].
2019-04-19 18:28:42 +02:00
Kornel Benko
6eb9452836 Amend [f2029fb3/lyxgit]
Omitting acces to invalid index
2019-04-18 15:07:30 +02:00
Enrico Forestieri
17abf68bac Amend [f2029fb3/lyxgit]
The fix for #11552 was reintroducing #9348. This commit makes sure
it stays fixed.
2019-04-17 18:08:46 +02:00
Enrico Forestieri
f2029fb386 Fix bug #11552
Do not insert a brace inset when we know that LyX wrote the braces.

This commit amends [503f7db2/lyxgit].
2019-04-17 16:03:13 +02:00
Jean-Marc Lasgouttes
f6f08f0c50 Revert "Make math autocorrrect work with more than 2 chars"
This reverts commit 144e7d7159.
2019-04-16 16:04:12 +02:00
Jean-Marc Lasgouttes
8e3972c35d Revert "Allow to undo partly math autocorrect"
This reverts commit f7a11ca711.
2019-04-16 16:03:57 +02:00
Jean-Marc Lasgouttes
048f9ee08e Rewrite the code that sets caret height in mathed
Instead of remembering the caret ascent and descent for the cell that contains the cursor, the new code remembers caret dimension for each MathRow object. This makes the code much less fragile (ans slightly smaller).

This fixes caret size issues when the Update::SinglePar flag is active.

Fixes bug #11541.
2019-04-16 15:58:51 +02:00
Jean-Marc Lasgouttes
f7a11ca711 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-04-16 14:12:34 +02:00
Isaac
144e7d7159 Make math autocorrrect work with more than 2 chars 2019-04-16 14:12:34 +02:00
Enrico Forestieri
506324ef9d Properly fix #9616
Now all symbols in the unicodesymbols file having a mathcommand
are not wrapped in a \text inset anymore.
2019-04-15 20:56:52 +02:00
Jean-Marc Lasgouttes
3b58e38dc6 Fixup ad79ac40: reintroduce markers around delimiters
The reasoning behind this change was not correct.

Fixes bug #11516.
2019-04-02 14:32:32 +02:00
Jean-Marc Lasgouttes
dfba0d8667 Fix insertion of text characters in math
Characters that needed to be inserted in text mode in mathed were not
correctly inserted. Here we do two fixes:

1/ in niceInsert(), do not replace the contents of the active insets
first cell with selection, insert selection instead. This wa sthe
cause of the bug: an empty selection replaced the contents that was
already in the cell.

2/ do not use niceInsert() anyway, insert() is perfect for what we
want to do.

Fixes bug #11527.
2019-03-28 13:22:38 +01:00
Jean-Marc Lasgouttes
cfb8b214d1 Treat math style a bit more like other font features
While math style (scriptstyle,...) is not really something that can be
set, it is useful for text subscripts and superscripts and therefore
it makes sense to handle it in some places.

With this change, style is still not a first class feature, but good
enough for now. In particular, it is taken into account in update().
2019-03-22 16:19:05 +01:00
Enrico Forestieri
9755371729 Fix conversion of math braces to html 2019-01-02 09:49:59 +01:00
Enrico Forestieri
b3cba2a09c Amend [2dcb7300/lyxgit]
Avoid a crash by checking that a cell is not empty before
accessing its content.
2019-01-02 09:08:39 +01:00
Enrico Forestieri
2dcb730026 Fix bug 11346
Enclose in braces an optional argument of a math macro when it
starts with an incomplete script inset or ends with a delimiter
size-modifier macro.
2018-12-18 11:39:21 +01:00
Enrico Forestieri
95bc273a59 Fix display of single-char macro names
Essentially, all characters are allowed in single-char macro names.

Part of #11158.
2018-12-13 19:41:56 +01:00
Jean-Marc Lasgouttes
2ec25c8eef Set buffer correctly when changing math space type.
Fixes bug #7747.
2018-12-13 10:27:20 +01:00
Enrico Forestieri
1bdba953a5 Fix cursor left/right navigation in overset, underset, and stackrel
Before this commit, navigating with the cursor was visiting either
the nucleus or the script depending on the direction (left or right)
of the cursor movement. Now the 2.3.x behavior of always going through
the nucleus is restored (at least for overset and underset, as stackrel
seems to behave oddly also in 2.3.x).
2018-11-12 19:05:09 +01:00
Enrico Forestieri
9c3bbeefab Fix bug #11367
The overset, underset, and stackrel insets behave like the script
rather than the fraction inset.
2018-11-10 15:50:51 +01:00
Enrico Forestieri
77234fecd8 Restore correct left/right navigation in root inset
Now all cells are correctly visited in sequence when moving with
cursor left/right.
2018-11-10 14:55:00 +01:00
Jean-Marc Lasgouttes
93db2bd08e Make cell-forward/backward cycle in math
Make cell-backward put the cursor at the end of cell when using
mac-like cursor movement.
2018-11-09 16:05:09 +00:00
Jean-Marc Lasgouttes
ee9451aaf5 improve left/right navigation in root inset
Now the cursor is correctly set when changing cell with xursor left/right.
2018-11-09 16:05:09 +00:00
Jean-Marc Lasgouttes
2daf493cbc Fixup 097da3a9: fix horizontal navigatiion in InsetMathRoot
Exchanging cells 0 and 1 requires to implement idxBackWard/Forward.
2018-11-07 11:53:00 -10:00
Jean-Marc Lasgouttes
974766cd1c Fixup 097da3a9: update the math parser
One has to account for the change in cell numbering.
2018-11-07 08:29:46 -10:00
Jean-Marc Lasgouttes
b0937fb93e When inserting math inset over selection, place cursor better
This is a follow up to 503c7c16.

The new argument for placing cursor after insertion of inset is:
* if inset has no cell, do nothing
* otherwise, place inset in entry cell.
  + if entry cell is not empty (we pasted a selection), go to next cell
  + if this next cell does not exit, stay after the inset.
2018-11-06 22:48:53 -10:00
Jean-Marc Lasgouttes
097da3a943 Change cell numbers so that 0 is the main cell
This leads to code simplification in overset, root and underset.
Further simplification is possible.
2018-11-06 22:48:53 -10:00
Richard Kimberly Heck
b1f1b2321b Fix part of bug #8521. 2018-10-04 21:02:51 -04:00
Richard Heck
5f6332bf46 Fix bug 9798.
Nameref support for math references.
2018-10-04 14:04:48 -04:00
Jean-Marc Lasgouttes
7cb0284a3f Fix display of gather in lefteqn mode
The column is flushed when the display of equations is flushed.

Not sure what to do with RtL languages.

Fixes bug 11324.
2018-10-04 16:09:54 +02:00
Jean-Marc Lasgouttes
837bcbb043 Make sure inset buffer is correctly set in math grid
Make MathData::setBuffer set the buffer of insets that it contains.
Remove corresponding code from InsetMathNest.

update the buffer() property in the following tabular-feature
actions : copy-row, add-row, copy-col, add-col.
2018-10-03 10:43:20 +02:00
Jean-Marc Lasgouttes
1b5ccecd65 Avoid space before completion in mathed
This can happen if the current element has space after it (e.g. before
a relation).

Fixes bug #11283.
2018-09-20 23:51:21 +02:00
Jean-Marc Lasgouttes
17576fb83b Avoid crash with cursor down in math
This can happen when the inset that contains the cursor is outside of
the screen.

THis is only a workaround. The real solution would be a
processUpdateFlags(FitCursor) call, but the code is not ready for that
yet.

Fixes bug #11296.
2018-09-20 22:18:36 +02:00
Jean-Marc Lasgouttes
0920872ebd Revert "Try to please windows compiler"
This reverts commit a8b0e64094.
2018-09-18 23:06:36 +02:00
Jean-Marc Lasgouttes
ad29b0067f Revert "Use new display() values to remove some inset hardcoding."
This is a work in progress that committed by mistake.

This reverts commit b28ec44476.
2018-09-12 15:26:15 +02:00
Jean-Marc Lasgouttes
b28ec44476 Use new display() values to remove some inset hardcoding.
The enum is now made of flags that can be combined.

This introduces several new values for Inset::DisplayType:
BreakBefore, BreakAfter and Display=BreakBefore|BreakAfter. This
last value replaces AlignCenter.

Additionally the flags NoBoundary and CanBreakAfter are introduced for
future use.

Now a left aligned displayed inset will be defined as Display|LeftAlign.

A newline inset is characterized as BreakAfter.

This structure is used in breakRow to avoid explicit calls to
isNewline() or isEnvSeparator(). More improvements will be built on
top of this.

Additionally several redundant display() methods (which returned
Inline) have been removed.
2018-09-12 11:38:01 +02:00
Jean-Marc Lasgouttes
6cfd733dea Fixup 7b7ed64a: allow toggling limits of (over|under)brace 2018-09-05 17:31:05 +02:00
Jean-Marc Lasgouttes
7b7ed64a0e Allow toggling (no)limits only after mathop symbol
In particular, introduce the new InsetMathScript::allowLimits method
that checks for that and honor it in getStatus/ddoDispatch.
2018-09-03 17:55:27 +02:00
Juergen Spitzmueller
372712cfd9 Fix problem of unwanted spaces caused by macro definitions
Patch by Gilbert J. M. Forkel

Fixes: #11216
2018-07-29 15:17:48 +02:00
Juergen Spitzmueller
a8b0e64094 Try to please windows compiler 2018-07-28 10:26:52 +02:00
Jean-Marc Lasgouttes
e4dba53232 Do not remove character at start of paragraph when cutting
The part of code that removed space at start of paragraph have been
there forever, but its intent is unclear. For example, cutting text at
the end of a paragraph will lead to remove space at the start of this
same paragraph.

The removal of this functionality is offset by a rewrite of DEPM that
makes it more thorough.

Fixes bug #10503.
2018-07-22 23:20:21 +02:00
Jean-Marc Lasgouttes
9b3fede789 Introduce FontMetrics::xHeight
Use it instead of measuring the height of character 'x'.
2018-07-19 22:16:40 +02:00
Jean-Marc Lasgouttes
ad5548cfe3 Fixes to input method handling
The goal of this patch is to make "self-insert <string>" act as a
sequence of individual self-insert calls. Once it is done, the
insertion of the commit string in GuiWorkArea can use that, which
fixes the issues described in bug 11183.

1/ in InsetMathNest, SELF_INSERT is rewritten to be a proper loop of
   interpretChar, instead of inserting the string as characters. This
   solves the issue of interpreting ^ properly.

2/ the text version does not need to be changed (the loop is rewritten
   using a range, though).

3/ Then {{{GuiWorkArea::inputMethodEvent}}} is changed to invoke
   directly self-insert. This removes the update issues.

Fixes bug 11183.
2018-07-05 14:32:37 +02:00
Jean-Marc Lasgouttes
2d02c39d56 Use getArg to read math-extern arguments
This avoids a use of istringstream that coverity dislikes.
2018-06-05 11:24:05 +02:00
Jean-Marc Lasgouttes
a3868e40a4 Set caret height correctly for cells inside math rows
The code in 90cfe4ec3 only handled the cells which metrics are
computed directly, and missed those who were linearized inside a MathRow.

To fix this, we use the fact that all the positions in a math row have
the same height and make MathRow::metrics return a boolean indicating
whether it contains a caret for a given bufferview.

Fixes bug #11153.
2018-05-24 14:47:08 +02:00
Jean-Marc Lasgouttes
c58b914c80 Reset dim width when computing MathRow metrics
This was dropped by mistake in 7bcb78a77.

Fixes bug #11152.
2018-05-21 13:26:48 +02:00
Jean-Marc Lasgouttes
c4075367fa Removed unused private variable
Spotted by clang++ 6.
2018-05-14 23:03:50 +02:00
Richard Kimberly Heck
df5805917b Do not step equation numbers in deleted equations. 2018-05-03 00:05:21 -04:00
Jean-Marc Lasgouttes
90cfe4ec3b Adapt caret height to context in mathed.
Compute a height from current font and current cell vertical
dimensions in MathData::metrics(), because this is where current font
is known.

Introduce BufferView::setCaretAscentDescent to remember this value.

This mechanism is not used for text because Cursor::current_font is
restored by undo, and the caret height would not be changed then. But
in principle it is doable.
2018-04-27 00:03:48 +02:00