Commit Graph

37666 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
8910a8a1cc Fixup 9c92494e1a: avoid crash in Inset::dissolve()
The code path when the inset is empty did not fixup the cursor
position correctly.

Part of bug #10667.
2017-06-23 19:44:54 +02:00
Kornel Benko
87ccd23047 Cmake export tests: Missed second parameter for writeConverters()
Unfortunatelly the prototype checking in perl is not very
sophisticated.
2017-06-21 00:09:50 +02:00
Jean-Marc Lasgouttes
d0acc3e570 Fixup 522516d9 : editable() is unusable in mathed
This is a relic from IU (Inset Unification): editable() is for text
insets and isActive() for mathed. This needs to be cleaned up.

Part of bug #10667.
2017-06-20 09:41:48 +02:00
Enrico Forestieri
4dea27c4c7 Fix bug #10546
A labeled equation is also numbered.
2017-06-20 01:14:55 +02:00
Jean-Marc Lasgouttes
4efb129ccb Avoid crash when selecting long text
In some (not yet understood) situations, the paragraph metrics cache
is empty in generateSyntheticMouseEvent(). We just avoid a crash in
this case, but there is probably an underlying problem that deserves
being fixed.

Fixes bug #10324.
2017-06-19 12:23:17 +02:00
Kornel Benko
c5e53637c2 Cmake export tests: Modularisation of prefTest.pl
Also added a parameter to easier switch between standard settings in
preferences and settings to use in export tests.
2017-06-18 12:13:57 +02:00
Enrico Forestieri
d4d7cdf9a1 Prune white space after the separating comma of options
Both listings and minted allow for many complex options. So, a latex
source can be easily written as

\documentclass{article}
\usepackage{minted}
\usepackage{graphicx}
\usepackage{dingbat}
\begin{document}
\begin{minted}[breaklines=true,
               breakautoindent=false,
               breaksymbolleft=\raisebox{0.8ex}{
                   \small\reflectbox{\carriagereturn}},
               breaksymbolindentleft=0pt,
               breaksymbolsepleft=0pt,
               breaksymbolright=\small\carriagereturn,
               breaksymbolindentright=0pt,
               breaksymbolsepright=0pt]{Python}
def f(x):
    return 'Some text' + str(x) + 'some more text' + str(x) + 'even more text that goes on for a while'
\end{minted}
\end{document}

The used text editor can therefore add a mixture of tabs and spaces.
The white space after the options is not a problem and the imported
file compiles just fine, but the validator gets confused and doesn't
validate them. This would entail a difficult editing of the options
only to have them validated. So, better remove the white space.
2017-06-17 20:41:29 +02:00
Enrico Forestieri
a1e65ad458 Amend 9b2b51a4
runtests.py was being forgotten and a string transliterated.
2017-06-17 19:35:10 +02:00
Kornel Benko
9b2b51a4db Tex2lyx tests: Added minted testcase from Enrico Forestieri 2017-06-17 19:12:17 +02:00
Enrico Forestieri
f135c8d227 Don't allow raw newlines in options
This happens if the options are split over multiple lines in the
latex source. A newline here confuses the lexer when reading the
converted LyX file.
2017-06-17 19:05:02 +02:00
Enrico Forestieri
9f9457eb00 Correct a default english layout translation
Of course, the default english translation for "List of Listings"
is "List of Listings", not "Listing".
2017-06-17 15:09:06 +02:00
Enrico Forestieri
000b7f3f46 Correctly skip a bottom caption
The getArg() method stops at the first closing brace, whether it
matches the opening one or not, so properly parse the caption and
then throw it away.
2017-06-17 14:01:42 +02:00
Juergen Spitzmueller
cde5d60fcf Update parent buffer as soon as a child has been released
This prevents dangling pointers that might crash LyX.

Fixes: #9979.

Candidate for stable.
2017-06-17 09:43:01 +02:00
Enrico Forestieri
7a9bb85184 tex2lyx: import minted listings
This commit updates tex2lyx in order to also import minted listings.
For the floating version of a listing, minted uses the listing
environment, a concept that is not shared with the listings package,
towards which our listings inset is geared.
For this reason, a kludge is necessary when importing minted listings
not previously exported by LyX itself.
If the floating listing contains only a caption and a label (other
than the listing itself), everything is fine and the import is (or
aims to be) perfect. But, as in all other floating ebvironments,
one can also stick there other elements, which don't have a place
in the listings inset. So, in order to avoid a data loss, tex2lyx
sticks everything into the caption. In this way, things may be
rearranged in the GUI, if necessary. There is no other way, apart
from a complete redesign of the listings inset, of course. However,
I think that this is an acceptable compromise.
2017-06-17 02:23:00 +02:00
Kornel Benko
195e55d3f4 Cmake export tests: Adapt to minted listings
1.) Handle also 'LatexCommand inputminted' in lyxStatus.pm
2.) Add '-shell-escape' to the appropriate converters.
  This applies only to the ctest-environment iff calling
  the script 'prefTest.pl' in the build directory.
2017-06-16 11:39:26 +02:00
Jean-Marc Lasgouttes
62b06c64ed Use the same code for editable and non-editable buttons
This removes the use of rectText in RenderButton. The fact that this
gave different spacing than buttonText was a problem.

Now buttonText requires to specify
* the offset, so that INSET_TO_TEXT_OFFSET is not used anymore in
  src/frontends/, which will be useful later.
* the background and frame color, in replacement for the hover state.

Remove the methods button() and buttonFrame() from GuiPainter.

Remove some unused header files.

Fixes bug #10704.
2017-06-15 15:40:30 +02:00
Juergen Spitzmueller
530fec453f Also catch "! Incomplete \\if" 2017-06-15 15:29:40 +02:00
Juergen Spitzmueller
39f23ac66b Catch "! Incomplete \\ifx" error
Fixes: #10666
2017-06-15 15:07:03 +02:00
Jean-Marc Lasgouttes
522516d99e Make fixIfBroken() more robust
Chop slice when its inset is not editable.

Fixes bug #10667.
2017-06-15 11:53:33 +02:00
Jean-Marc Lasgouttes
9c92494e1a Avoid memory reuse problems with inset-dissolve
If
 1. the inset is deleted before pasting its contents in the outer text, and
 2. the inset contents begins with an inset, and
 3. the clone of this inner inset is allocated at the memory location just
    made free,
then bad things can happen.

To avoid this, we delete the inset only after its contents has been pasted.

Fixes bug #10667.
2017-06-15 11:53:33 +02:00
Jean-Marc Lasgouttes
939962869b Give 4 edit markers to all Frac-like insets
Part of bug #10688.
2017-06-14 15:38:47 +02:00
Jean-Marc Lasgouttes
2e84b8030e When entering an inset by cursor, reset boundary
This happesn when cursor-left/right enters an inset.

Fixes bug #10630.
2017-06-14 15:08:27 +02:00
Enrico Forestieri
e2ce2e80d7 Update it.po 2017-06-13 19:57:58 +02:00
Jean-Marc Lasgouttes
cc7917c55c Add lower corners for BOX_MARKER too
Let's see whether this helps Guillaume.

Part of bug #8883.
2017-06-13 12:18:26 +02:00
Kornel Benko
82fc30138c Update sk.po 2017-06-13 11:18:17 +02:00
Juergen Spitzmueller
3892ed8677 de.po 2017-06-13 10:09:48 +02:00
Enrico Forestieri
6e7f69c6d1 Update it.po 2017-06-13 02:34:03 +02:00
Enrico Forestieri
7fdaed0ad7 remerge po files, except sk.{po,gmo} as requested 2017-06-13 02:11:51 +02:00
Enrico Forestieri
c86f9d81e7 Avoid a crash if an external template is not installed 2017-06-12 21:24:52 +02:00
Jean-Marc Lasgouttes
5d7dae9e38 Set cursor properly after double/triple click in mathed
Without this setCurrentFont() is not correctly called on the
BufferView cursor and the cursor could appear in L-form.

Fixes bug #10686.
2017-06-12 18:02:39 +02:00
Enrico Forestieri
ae56167718 Use a combo box instead of a check box for selecting the listings package 2017-06-12 17:24:26 +02:00
Jean-Marc Lasgouttes
95c6781112 Improvements to inset edit markers
Draw also upper markers when editing macros in MACRO_EDIT_INLINE_BOX mode.

Use MARKER2 for inline editing of macros.
2017-06-12 17:09:58 +02:00
Jean-Marc Lasgouttes
f6b0ccf99c Use proper markers for display version of the math macro template.
This avoids ghost white corners when the macro does not have a display
version.

Part of bug #8883.
2017-06-12 15:15:55 +02:00
Jean-Marc Lasgouttes
71563835c7 Avoid rounding issue when painting selection
This is the same issue that was addressed in the all_sel case at
695b0cc3. The rounding issue only happens at specific zoom and
jusification values.

Fixes part of #8883.
2017-06-12 14:39:03 +02:00
Jean-Marc Lasgouttes
c9fefd5a2c Fix bad cursor positioning when entering an inset
The test added at 359aef92 was incorrect. Actually, Inset::editXY
returns the inset when it is edited and also when it is not, which
can be confusing. So if we are unlucky and the slices positions in the
text area and in the inner inset match, the code below triggers and
many bad things can happen.

Also improve the documentation of Inset::editXY and TextMetrics::editXY.

Fixes #10691.
2017-06-12 13:51:24 +02:00
Enrico Forestieri
887445537a Switch parameters validation even before applying the changes
In the document settings allow to immediately switch from one
package to the other for parameters validation without the need
of first applying the changes.
2017-06-12 11:54:59 +02:00
Guillaume MM
5fda4e85c7 Unhide buffers that are marked dirty as a result of external modifications
Several comments in the code point to the fact that hidden buffers are assumed
to be clean.

The other solution was to adapt the closing & saving code to take into account
hidden dirty buffers. Experience shows that it is more useful to unhide the
buffers at the moment of the external modification, in the context of a git
workflow where one has to reload the modified children buffers one-by-one.

Fixes crash at #10603
2017-06-11 19:51:17 +02:00
Guillaume MM
fd6189b7e3 Remove FileMonitorBlocker which does not work reliably on all platforms 2017-06-11 19:51:17 +02:00
Guillaume MM
b30161b591 If the external modification is a deletion, do not ask for reloading.
The behavour when hitting "reload" on a deleted file was also confusing.
2017-06-11 19:51:17 +02:00
Guillaume MM
2058faaa3b Prevent false positives in external modifications
When the Buffer is notified to be externally modified, check that the
file contents have changed using the checksum.

Document the shortcoming of FileMonitorBlocker.

Fixes #10642.
2017-06-11 19:51:17 +02:00
Guillaume MM
db58111360 Properly track the lifetime of signals2::slots (#8261)
Starting at 61b2bd5e, boost::bind was progressively replaced with
std::bind. They are not interchangeable though. boost::bind implements
the tracking of boost::signals{,2}::trackable objects. Now that
std::bind has completely replaced boost::bind, tracking never occurred.

This commit replaces boost::signals2::trackable with the new preferred
boost::signals2 methods: scoped_connections or slot::track_foreign. The
support::Trackable class introduced is less safe but easier for transitioning
old code.

Fixes the crash at #8261.
2017-06-11 19:51:17 +02:00
Enrico Forestieri
3f61375bc3 Adjust minted options
- Remove "chapter" and "section" as this are to be passed as class
  options and are otherwise not recognized.

- Let onoff=false for all TRUEFALSE parameters, otherwise only the
  form option=true is accepted and option=false does not validate,
  generating a lot of confusion.
2017-06-11 17:51:24 +02:00
Juergen Spitzmueller
1009e44746 de.po 2017-06-11 16:42:35 +02:00
Kornel Benko
fd05261a55 Update sk.po 2017-06-11 14:51:03 +02:00
Kornel Benko
7fc170c951 Cmake build: Totally missed lokalization of lib/citeengines/*.citeengines. 2017-06-11 14:42:05 +02:00
Enrico Forestieri
570ad4219e Remerge strings again after last change 2017-06-11 14:02:02 +02:00
Enrico Forestieri
55223bdcaa Add accelerator 2017-06-11 13:58:34 +02:00
Enrico Forestieri
027cad7f96 Add documentation for minted 2017-06-11 13:42:35 +02:00
Enrico Forestieri
405d71c172 Unify translations
This entry is shared by both listings and minted, so no need to use
different strings.
2017-06-11 12:34:17 +02:00
Enrico Forestieri
6ede3c5f47 Update layouttranslations and remerge po files.
Only the new field "List of Listings" with same translation as
for "Listings[[List of Listings]]" has been added. No other change
has been done, so layouttranslations might actually change again
when automatically updated.
2017-06-11 12:24:24 +02:00