Commit Graph

32804 Commits

Author SHA1 Message Date
Enrico Forestieri
061509bf75 Avoid an assertion.
Do not assert if an inset separator is the only item of a List
environment. Although it is a weird thing to do, both GUI and
latex output can deal with it.
2014-05-28 20:50:45 +02:00
Jean-Marc Lasgouttes
0212ef5426 Make TextMetrics::editXY more robust
This fixes a crash in examples/fa/splash.lyx when selecting text
representing menu entries. This happens because menu names are in LTR
English, while the inset itself is in RTL.

The problem is that the current code relies on the fact that
 1. getColumnNearX and checkInsetHit share the same idea about cursor
    position.
 2. pos and pos + 1 are in general consecutive on screen.

It seems that 1. is wrong here (for reasons I did not try to
understand); the second assumption is definitely false with
bi-directional text. This makes editXY very fragile.

The new code should be more robust in this respect. The logic is:
 * if checkInsetHit finds an inset, use its position,
 * otherwise, ask getColumnNearX for the cursor position.

Fixes: #9142
2014-05-28 14:22:21 +02:00
Enrico Forestieri
c85dbfea98 Fix indentation of paragraphs after an environment.
When deciding whether a paragraph should be indented or not, LyX
only takes into account default layouts. This is wrong, because
an environment could be nested into another one and thus a following
paragraph would not be "default". With this patch all paragraphs
after an environment are correctly indented, independently of
whether their layouts are "default" or not.
The latex output (which was modeled following the previous wrong
assumption) is also correspondingly adapted.
2014-05-28 01:07:47 +02:00
Georg Baum
4cea2efe21 Native support for \notag
This is mainly needed to reduce the amount of ERT if you convert AMS example
documents with tex2lyx. No GUI support is needed, since \notag is equivalent
to \nonumber.
2014-05-27 22:17:35 +02:00
Georg Baum
5dc9568f8d Native support for \smash[t] and \smash[b]
This is a follow-up of bug #8967. The implementation is self-explaining, the
only part which needs a comment is lyx2lyx: Since a 100% correct solution is
not possible, it has been decided not to switch amsmath off in the forward
conversion if no other ams command than \smash[t] and \smash[b] is used, but
to consider it a bug that older versions do not load amsmath automatically for
these commands. In the backward direction it is easy to keep the document
compilable, so just do that.
2014-05-27 22:13:58 +02:00
Georg Baum
ff8450f839 Add missing member initializations 2014-05-27 22:13:58 +02:00
Enrico Forestieri
d4c21b42dd Allow inserting a blank line also after a nested environment. 2014-05-26 21:29:33 +02:00
Juergen Spitzmueller
c7eb04158f Clean up empty ERTs that are produced in comples beamer argument conversions 2014-05-25 22:46:42 +02:00
Juergen Spitzmueller
e8e75f45b9 Support spreaded argument delimiters in beamer block conversion 2014-05-25 22:42:44 +02:00
Juergen Spitzmueller
57664026f2 In collorary conversion, support argument delimiters spread over several ERTs
The roundtrip still has issues.
2014-05-25 15:08:08 +02:00
Juergen Spitzmueller
36051e1daa Fixes in the beamer block routine
This makes beamerlyxexample1 open after the roundtrip, but the file does not compile yet (remaining issues in other routines)
2014-05-25 15:00:38 +02:00
Kornel Benko
046001e571 Make: improve detection of X11 with Qt 5
In collaboration with Scott Kostyshak:
With Qt 4 we could use Q_WS_X11, defined by FindQt4.cmake. In Qt 5,
there is no FindQt5.cmake. Instead we now define our own variable,
QT_USES_X11 by using class QX11Info available only on X11.
(http://qt-project.org/doc/qt-5/QX11Info.html)

The main consequence of this improved support is that now the keytests
can be run (ctest -R "keytest") when LyX is compiled with Qt 5.
Before, with Qt 5 we did not know if X11 was available, which is
needed by xvkbd, so the tests were not enabled. Note, however, that
many tests fail with Qt version 5.2.1 because there was a change in
the event handling mechanism in Qt that causes xvkbd to be unable to
pass capital letters (so case sensitive greps in the tests fail). This
needs to be investigated and reported.
2014-05-25 13:50:18 +02:00
Scott Kostyshak
e716f1ef12 Add Sumatra as a PDF reader
It currently does not make a difference that it is before
Adobe Reader in configure.py because as Enrico points out
on Windows the default viewer configured in the OS is used.
2014-05-24 07:37:16 -04:00
Richard Heck
643deb8aa0 Add a FIXME. 2014-05-23 11:36:12 -04:00
Richard Heck
b992968a15 Fix bug #9131 for development branch. There are two parts to the fix.
The firs tinvolves a thinko in BibTeXInfo::expandFormat. We were previously
counting passes through this routine, which means: one for every character,
more or less. So long strings would hit the "recursion limit". But what
we are worried about is an infinite loop caused by misues of macros, so that
is what we need to count.

This prevents the error we were previously getting, but it reveals a huge
slowdown when one tries to open a citation inset with a large nubmer of keys.
So we also limit the number of keys we try to process, and the length of the
string we try to display, when we are generating citation information.

I'm convinced that there is a deeper problem in how citation information is
generated (see the bug tracker for more info), but that will require major
surgery and a file format change
2014-05-23 11:26:45 -04:00
Richard Heck
ba17d842b4 Add some const-ref-ness, and remove some default arguments that are
never treated as defaults.
2014-05-23 11:03:17 -04:00
Richard Heck
344ea62dd0 Fix up logic of BibTeXInfo::getInfo. We don't need to process the
richtext stuff unless we actually need it.
2014-05-23 10:48:22 -04:00
Kornel Benko
b178770ce3 Cmake export tests: Parse also for nameless layouts in lyx-files 2014-05-23 11:32:19 +02:00
Enrico Forestieri
a596736d76 Fix another glitch with on-screen indentation.
If a new paragraph is created just before a nested environment,
the indentation of the nested environment is not computed
correctly because the parindent of the previous layout would
also be erroneously taken into account. This would cause the
nested environment to move back and forth when something is
added to the new paragraph.
2014-05-22 23:58:23 +02:00
Georg Baum
85db1005b6 Fix another crash similar to #9030
This one occured after the fix for bug #9030 if the cursor is in a math inset
and the edit menu is opened.
2014-05-22 22:02:46 +02:00
Enrico Forestieri
02e7bc18a7 Simplify the test for inserting a parbreak separator.
Instead of simply taking into account the layout of the previous
paragraph, it is better considering the layout of the environment
in which the previous paragraph may be nested. This makes the test
simpler and, at the same time, more robust.
2014-05-22 21:47:10 +02:00
Enrico Forestieri
52ebcd6280 Correct the check for a command. 2014-05-22 11:51:21 +02:00
Enrico Forestieri
2c613d5686 Fix potential crash.
Use the lfun for breaking the paragraph here, such that the metrics
are updated before the call to the next dispatch.
2014-05-22 11:41:23 +02:00
Enrico Forestieri
a17710e499 Fix wrong indentation on screen.
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)
2014-05-21 21:47:01 +02:00
Enrico Forestieri
27e0bf54f5 Add a required paragraph break.
This is necessary, for example, if a standard paragraph is nested
in an environment and the environment does not end immediately after.
To be strictly correct, the layout of the following paragraph should
be compared to the layout of the nesting environment, otherwise, if
they are not the same, an empty line is nevertheless output. However,
this is harmless because an "\end{layout}" tag immediately follows.
2014-05-21 21:08:11 +02:00
Pavel Sanda
70ce2dffcf * Additional.lyx - note for windows git users.
https://www.mail-archive.com/lyx-users%40lists.lyx.org/msg98988.html
2014-05-21 11:12:02 -07:00
Pavel Sanda
58237ad525 Add layout translation bit from Guy.
https://www.mail-archive.com/lyx-users%40lists.lyx.org/msg98950.html
2014-05-21 10:53:19 -07:00
Juergen Spitzmueller
58db7c34f9 Output arguments required by arguments with default or preset arg
Fixes: #9128
2014-05-21 13:12:14 +02:00
Juergen Spitzmueller
c21e51a4f9 Fix nesting in some beamer reversion methods.
Patch by Enrico
2014-05-21 11:37:51 +02:00
Juergen Spitzmueller
9b4160e0f8 Fix reversion of beamer overprint when a nested paragraph has an argument 2014-05-21 11:36:47 +02:00
Enrico Forestieri
8d8d8e9df6 Small reorganization.
I am not sure I fully understand the pending_newline/unskip_newline
logic (which seems mainly related to rtl writing), so I prefer to
leave it alone, in the sense that now things go again as in 2.1
until the point where those booleans are used for producing output.
If it turns out that a spurious (and unwanted) empty line comes
from the previous code, it can be easily corrected later.

I am also reintroducing the check about a separator inset at the end
of the paragraph, because that is necessary for the plain version.
2014-05-21 00:59:36 +02:00
Enrico Forestieri
7145863466 Generalize control on double blank lines.
We can now tell whether a blank line was just output and so can
avoid outputting another one.
2014-05-20 21:52:29 +02:00
Scott Kostyshak
fc19148f6d Fix a GCC warning: comparing signed vs. unsigned
This also changes the type of an int to an ssize_t.

nRead is initialized as an ssize_t because it could
be negative. It is cast to a size_t for comparison
to the size of a vector, but only after we check
that nRead is not negative.
2014-05-20 08:01:49 -04:00
Jean-Marc Lasgouttes
275b7af75e Code cleanup: get rid of RenderPreview::status()
This method is a proxy for LyXRC::preview that forces to forward
declare some wrapper around an enum...

Instead, two simple static methods previewMath() and previewText() are
introduced, that make the code much easier to follow.
2014-05-20 12:19:26 +02:00
Juergen Spitzmueller
8226453684 Fix crash due to invalid pos 2014-05-20 11:14:13 +02:00
Enrico Forestieri
480f8d3115 Fix compilation after afc34c7a 2014-05-20 00:43:46 +02:00
Georg Baum
f5b829bc8a Initialize all members 2014-05-19 22:41:51 +02:00
Georg Baum
afc34c7a60 Fix bug 9030 except for windows
The format entries should be sorted according to the culture selected for the
UI. This was not the case previously, resulting in unexpected sorting of small
and capital letters. This is now fixed by using the standard C function
strcoll(). Qt does only offer similar functionality in Qt5, and this is not
mature enough yet to depend on it.
Unfortunately we have a report that strcoll() does not work on MSVC, however
this partial fix is better than nothing. The MSVC issue might also be a
configuration problem, since MS claims that strcoll() is supported. This
still needs to be checked.
2014-05-19 22:37:14 +02:00
Georg Baum
2acd00fc17 Remove unneeded slash
addPath() always adds a slash at the end, os got a double one before.
Qt and the OS are clever enough to understand that, but a single slash
looks more nice.
2014-05-19 22:09:12 +02:00
Georg Baum
923ab0734d Move code where it belongs
It is declared in Dimension.h, so the implementation should be in
Dimension.cpp.
2014-05-19 22:07:04 +02:00
Georg Baum
35ec98bcb2 Ugly fix for bug #9102
The real problem is the encoding of latex_language: It is hardcoded to latin1,
but InsetListig uses the currently active encoding. Therefore, we cannot tell
whether any given character wil be encodable or not, and we should not prevent
non-ACII characters.
In the future, we need to make the encoding of latex_language dynamic, so that
it always represents the currently active encoding. Then, we could do the
correct check both for listings and ERT. For now, I simply disabled the
encoding check for listings, which also means that bug 9012 might occur in
other cases for listings, but this is less important than bug 9102.
2014-05-19 21:40:11 +02:00
Enrico Forestieri
cda00d8329 Fix reversion of beamer documents.
Beamer documents do not have a "--Separator--" layout but a
"Separator" one. Also fix a thinko causing the deletion of
"\end_layout" tags in some cases.
2014-05-19 19:39:51 +02:00
Richard Heck
72acf9fb27 Fix copy/paste error, and whitespace. 2014-05-19 09:41:05 -04:00
Enrico Forestieri
1ad3f809a4 Prettify the output of InsetSeparator.
If a separator inset is used after an environment with NextNoIndent
set to false, a blank line was already output. So, avoid outputting
another blank line or an odd looking line with only a '%' character
(as the previous blank line provides already a visual separation).
2014-05-18 23:02:24 +02:00
Enrico Forestieri
ee9ff6cb0c Extend the otexstream class to also report about paragraph breaks.
The new method afterParbreak() returns true if a blank line was just
output and we are at the beginning of the next line, false otherwise.
2014-05-18 22:46:33 +02:00
Enrico Forestieri
10d5897327 Don't allow inserting two consecutive separators. 2014-05-18 18:04:53 +02:00
Juergen Spitzmueller
c5753af50d Fix crash when right-clicking into an inset with more paragraphs than the main text.
Fixes: #9123.
2014-05-18 18:03:06 +02:00
Enrico Forestieri
0616c8fe32 Disregard font properties changes when inserting a separator.
This allows to output a simple blank line instead of strange constructs.
2014-05-18 17:34:11 +02:00
Enrico Forestieri
a919cd8c68 Take into account that a blank line is always output before a command. 2014-05-18 17:31:58 +02:00
Richard Heck
4d30b613ba Whitespace. 2014-05-18 11:27:54 -04:00