Commit Graph

193 Commits

Author SHA1 Message Date
Juergen Spitzmueller
4feec2ef4b Properly fix bug #9598
Do not output \\par at the end of environments with size change if the
environment cosinsts of only one par.
2015-06-09 08:18:19 +02:00
Juergen Spitzmueller
8e671a5cdc Revert "No \\par after greyedout notes (bug #9598)"
This reverts commit f929f21228.

It is not as easy as this. See ticket.
2015-06-09 07:57:19 +02:00
Juergen Spitzmueller
f929f21228 No \\par after greyedout notes (bug #9598) 2015-06-09 07:44:03 +02:00
Georg Baum
b596330093 Fix compilation with boost 1.58
Newer boost versions use complicated type traits for boost::next and
boost::prior, which do not work with the RandomAccessList iterators.
The long term solution is to use std::next and std::prev, for now supply
simple replacements for compilers that do not support C++11 yet.
2015-05-16 00:05:23 +02:00
Juergen Spitzmueller
b9573096f7 Factor out polyglossia language begin command construction and apply forcelocalfontswitch to polyglossia as well. 2015-05-03 16:08:14 +02:00
Juergen Spitzmueller
efb4a26512 Make ParBreakIsNewline work in inset layout without PassThru
Fixes: #9513
2015-04-21 19:43:41 +02:00
Juergen Spitzmueller
8c1a484cd2 Use local babel language switch in fixed width cells in order to prevent unwanted whitespace
Fixes: #9455
2015-04-04 11:59:01 +02:00
Juergen Spitzmueller
d9b87d651a Fix bug with wrong baseline calculation in last paragraph (2nd attempt)
This time, we consider the cases where a \par is not wanted (single-par insets, tabular cells).

Fixes: #9231
2014-09-01 09:14:26 +02:00
Juergen Spitzmueller
9c05f221f9 Revert "Fix bug with wrong baseline calculation in last paragraph"
This reverts commit b555f31a34.
2014-08-28 08:38:27 +02:00
Richard Heck
b9fe1dd10b Use a const ref here. Guess it was a thinko when I did it. 2014-08-12 12:32:58 -04:00
Juergen Spitzmueller
b555f31a34 Fix bug with wrong baseline calculation in last paragraph
Fixes: #9231
2014-08-03 11:26:16 +02:00
Georg Baum
5a8b8ba8e1 Make LaTeX export threadsafe.
This is one of the more important threadsafety issues because of export in
thread and simultanous view source. The solution is ugly, but a better one
(see FIXME) would require major rework. These static variables should not
have been used in the first place IMHO.
2014-07-05 14:23:43 +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
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
Juergen Spitzmueller
58db7c34f9 Output arguments required by arguments with default or preset arg
Fixes: #9128
2014-05-21 13:12:14 +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
Juergen Spitzmueller
8226453684 Fix crash due to invalid pos 2014-05-20 11:14:13 +02:00
Enrico Forestieri
936773c4f7 Adapt output to the on-screen representation.
LyX assumes that a standard paragraph following an aligned one or
a layout with NextNoIndent==false has to be indented on screen.
This means that in the latex output a blank line has to follow.
In this case there should be no problem as regards extra vertical
space and it simpler and more elegant to simply uncheck "Indent
Paragraph" in the Paragraph settings pane rather than changing
the current logic and allowing to insert a parbreak separator.
2014-05-16 15:39:33 +02:00
Enrico Forestieri
7d5b1fb840 Output a parbreak after a command.
This is what LyX was previously doing. It has no effect on vertical
spacing but, for example, sectioning commands stand out on the output.
The parbreak is not output if an environment follows or the alignment
of the current or next paragraph is changed.
Also remove some superfluous code.
2014-05-14 22:25:15 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Juergen Spitzmueller
7c1fc6ea75 Include child's own authors when using BufferParams from master. 2014-03-13 06:43:38 +01:00
Juergen Spitzmueller
50bcd6ed7b Use the master buffer's param when compiling as a child (#8893) 2013-11-18 08:46:50 +01:00
Juergen Spitzmueller
a8a2bd463c Force encoding switch when switching from/to CJK, even if we use a customized encoding (#8558) 2013-05-20 13:40:40 +02:00
Juergen Spitzmueller
a78bed06eb revert parts of 53002538 which set wrong local_font 2013-05-20 12:31:46 +02:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Juergen Spitzmueller
41060c9723 Allow to specify default argument for layout/inset argments
This default argument is inserted iff no inset argument is present. This is useful particularly for mandatory arguments that need to have a sensible default value.
2013-02-24 11:29:21 +01:00
Jean-Marc Lasgouttes
dc5d63ae24 Fix bug #8049: extra empty line at the end of verbatim environment 2013-01-25 12:18:40 +01:00
Georg Baum
de5e348727 Fix bug #8468: Wrong import of UTF8 CJK.
Actually, the test case showed several problems:
- ERT insets did use layout "Standard", not "Plain Layout"
- The font scale was read correctly, but tex2lyx claimed that it did ignore
  the option "scaled=0.95"
- If a third argument of the CJK environment was given, it caused the whole
  environment to be put in ERT with a broken encoding. This is now fixed for
  the bug test case by using the \font_cjk header variable, but the encoding
  problem still exists for unsupported encodings. I'll file a separate bug
  for that.
- The CJKutf8 package was not handled in the preamble parsing. Therefore the
  chinese comment in the preamble was read with a wrong encoding, and guessing
  the document language did not work.
The new file CJKutf8.tex was created by copying and modifying CJK.tex, but
unfortunately it is impossible to tell git to inherit the history of CJK.tex
for the new file (search the web for git svn copy if you want to know details).
2012-12-30 20:52:49 +01:00
Juergen Spitzmueller
37f41fd4b5 Support for command argument placement after the workarea argument 2012-12-28 11:21:24 +01:00
Juergen Spitzmueller
7af6a7b910 fix latexArgInsets for sequences qith nested paragraphs 2012-12-24 13:02:24 +01:00
Juergen Spitzmueller
3934f4a36f In multi-par sequences, check for arguments in all pars 2012-12-23 17:37:50 +01:00
Juergen Spitzmueller
c3aa718151 Make the \item command in lists customizable 2012-12-19 16:55:22 +01:00
Juergen Spitzmueller
e93f4d470d Possibility to specify a preset argument
This will be needed for beamer plain and fragile frame support.
2012-12-10 14:09:51 +01:00
Juergen Spitzmueller
1500e44cba Support for \item arguments 2012-11-29 15:34:20 +01:00
Juergen Spitzmueller
a7f8fb8c5f Provide option to force a local language switch where a global is not allowed (fixes #8033) 2012-11-28 20:55:21 +01:00
Juergen Spitzmueller
53002538fa Pass local font to arguments and assure pass_thru is inherited 2012-11-28 19:02:07 +01:00
Juergen Spitzmueller
4d1b495139 LaTeXParam and Argument do not necessarily exclude each other 2012-11-26 13:09:54 +01:00
Richard Heck
1252c22fd3 Some minor cleanup of new InsetArguments stuff that I did while
reading the patch....
2012-11-23 20:40:38 -05:00
Juergen Spitzmueller
2e69c66195 InsetArgument revision, first working version 2012-11-19 14:21:02 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Juergen Spitzmueller
5b374e0c29 do not output empty language switch commands (bug #8216) 2012-06-24 10:56:08 +02:00
Juergen Spitzmueller
ca16190006 fix bug #8208: missing \end for polyglossia-only languages at buffer end 2012-06-23 15:44:25 +02:00
Juergen Spitzmueller
20d7e088fa less opaque bool naming and consistent use 2012-06-23 15:41:05 +02:00
Jean-Marc Lasgouttes
a756403301 "Performance" fixes suggested by cppcheck
While cppcheck did not turn out any suspicious error messages, using
the "performance" flag highlighted several nitpicks in three categories
 * do not use it++ for iterators, ++it is better
 * do not use size() to test for emptyness, empty() is here
 * do not use "const T" as a function parameter, "const & T" is better

I doubt that any of these is a real performance problem, but the code is cleaner anyway.
2012-05-28 22:42:44 +02:00
Georg Baum
8e8c214bef Fix some bugs related to spaces in math:
- Interpret argument of LFUN_SPACE_INSERT correctly
- Use InsetMathSpace instead of InsetMathSpecialChar for "\ " (bug # 7728)
- Use InsetMathSpace instead of InsetMathChar for ~ (bug # 7728).
  This fixes also the display in LyX (previously a literal ~ was displayed).
Using InsetMathSpace enables also the "Insert Formatting" menu entries.
No file format change is needed, since the LaTeX export is unchanged.
Note that there are still some bugs related to spaces in math:
#7746, #7747, #7749, #7842


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39947 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-23 20:19:49 +00:00
Jürgen Spitzmüller
5118d369e1 finally commit the fix for #7607.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39696 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-17 15:25:14 +00:00
Richard Heck
f76d28c118 Just a bit of cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38933 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-02 19:55:08 +00:00
Richard Heck
7305ddb6bf Fix some typos.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38932 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-02 19:39:44 +00:00