boost::regex supports escape sequences starting with a backslash in format
strings of regex_replace, but std::regex does not. Therefore format strings
involving literal backslashes have to be written differently for both flavours.
The special MSVC handling in regex.h is removed, since it is not needed
anymore, and using grep syntax would definitely be wrong.
The computation of the legth of expanded hfills did not take into account their unexpanded size. This is done now by increasing the dimension (+=) instead of merely setting it.
Moreover, since the insets sizes are integer number, rounding effects have to be taken in account. To this end, the extra number of pixels is added to the last hfill in the row.
This fixes part of bug #9860.
Note not everything is fixed by this patch: the logic of ParagraphMetrics::hfillExpansion seems bogus to me. I do not see why consecutive hfills at the beginning of a row should not be all expanded. Since I do not know what are the peculiarities of hfill handling in LaTeX, I did not change it (yet).
I did not either try to investigate the label hfill part, because I do not even know what is so special about it. I think there is a lot of old logic that nobody ever tried to question.
This is done by implementing contentAlignment() for this inset.
In order to display properly 'stretch' alignment, the code for TextMetrics::getAlign is rewritten to include some code that was in computeRowMetrics.
Back references in the format string of regex_replace use the syntax $n both
in std::regex and in boost::regex for the default format. Boost seems to
support the syntax \n in addition, but it is not documented at
http://www.boost.org/doc/libs/master/libs/regex/doc/html/boost_regex/format.html.
Therefore it is a good idea to use $n also for boost.
The changed code is not used, but I tried to use a similar approach for
boost::regex, and found some problems:
- regex_replace and regex_search are implemented in the replacement, so they
must not be used directly
- an smatch object must be given by reference (as in the called methods),
otherwise an exception would be thrown at runtime
- the commented out regex_replace version is actually needed
This code is supposed to be deleted, but nevertheless I wanted to record here
how it had to be modified if it was actually needed.
It was possible for errors that occured in the first run to be shown
in the error list after the second run. Now, the errors are cleared
before the second run.
Although I do not have a reproducible example at hand, I imagine
this situation would occur if a rerun is required and there is still
an error after the rerun.
Related to #9765.
Before, the exit code for the first LaTeX run was used to set the
flag, which caused an error to be reported when in fact there was no
error on the second run.
This fix ammends 1dbf0e5a.
When importing TeX code like
%comment
TEXT
the LyX document currently becomes
[ERT %comment] TEXT
so that TEXT is now part of the comment.
Now output_comment adds a trailing newline if the token after the
comment is not a newline. Note that the newline that marks the end of
the comment has already been parsed at this point.
tex2lyx tests have been checked manually and updated.
Fixes ticket #9551.
A plausible scenario is that change tracking is used together with a versioning
system. In this case, parallel modifications might remove an \author line on one
side, and add another change of this author on the other side. This scenario
causes a bad merge after which the added change has no associated author. In
this case, LyX used to display a list of errors on opening and deliberately
removed the corresponding change tracking information.
* If ever a tracked change refers to an author that does not exist, then add a
dummy author. This dummy author is not saved to the file afterwards.
* Have a very clear error message on opening such a corrupt file.
This is better because it implements a LRU cache. Indeed, while editing in particular, width of many different strings has to be computed. This is different from the previous situation where only width of single characters was computed and cached.
This popped up in cmake monolithic build once. It looks like BufferView is
included indirectly by some of the other headers (otherwise we would have seen
compile errors for other build configurations as well), bu I'll keep the
forward declaration since we don't want to depend on this indirect header
inclusion.
N_() is a preprocessor macro to mark translatable static strings. It is not a
good idea to also name a class member variable N_: It did only work in the
other build configurations because gettext.h was not included.
Updating all previews (even if only one has changed) is more costly
than I thought. Thanks to Guillaume for tracking down this
performance issue.
This reversion is related to the reversions at 358745d0 and
a7a14395. See also #7242 and #9855.
This reverts commit 29948eec26.
Updating all previews (even if only one has changed) is more costly
than I thought. Thanks to Guillaume for tracking down this
performance issue.
This reversion is related to the reversion at 358745d0.
See also #7242 and #9855.
This reverts commit 66f527e417.
Prevent encoding changes whenever the TeX engine is XeTeX or LuaTeX,
as XeTeX/LuaTeX use only one encoding per document:
* with useNonTeXFonts: "utf8plain",
* with XeTeX and TeX fonts: "ascii" (inputenc fails),
* with LuaTeX and TeX fonts: only one encoding accepted by luainputenc.
+1 no needless encoding switches
+1 runparams.encoding matches the correct encoding at any time
+1 less complicated code.
-1 there may still be problems with CJK (possibly impossible to
solve for Xe/LuaTeX with TeX fonts).
For LuaTeX & TeX fonts, the complete document uses the encoding
of the global document language.
See also #9740.
The referenced commit lead to performance issues and possibly
crashes in some cases when saving preferences. Thanks to Guillaume
for discovering the issues. See #9828 for more discussion.
I hope to come up with a better fix for #9507.
This reverts commit 390ae05444.
LyX format, create a backup of the original file. We put it in the backup
directory, if one exists, otherwise in the directory the original file is
in. This is the same strategy as for normal backups. Basically, the only
diferences are: (i) what name we use and (ii) we do not over-write any
backups that may already exist.
Actually, the changed tests were used to prevent overwriting the encoding
changed in Buffer::writeLaTeX with a language-default encoding.
This is still required for XeTeX with TeX-fonts unless a proper solution is found.
Documents with more than one encoding and TeX-fonts fail with LuaTeX,
as "luainputenc" can only handle one encoding.
With inputenc == "auto" or "default", the encoding changes with
the language and must be reset after an eventual language switch in insets
or environments (see #6216).
However, whether we need to do this does not depend on 8-bit TeX vs. LuaTeX
but on the possible use of more than one encoding for the document.
With "nonTeXFonts", the encoding is utf8,
LuaTeX with TeX fonts requires encoding handling similar to 8-bit TeX.
(Additionally, the value of "params.inputenc" could be tested: if it is
not "auto" or "default", we have just one common encoding and could skip
the reset as well.) Not sure how much time this saves, though.
This is one part of bug 9744: If you toggle between TeX fonts and non-TeX
fonts, the settings of the other choice are no longer thrown away, but stored
and re-activated if you switch back. Most parts of the patch are purely
mechanical (duplicating some BufferParams members), the only non-mechanical
change is in the GUI logic.
and record an undo call. This deals with the problem of marking
the Buffer dirty, as well.
Move LFUN_BUFFER_TOGGLE_COMPRESSION and LFUN_BUFFER_TOGGLE_OUTPUT_SYNC
to Buffer.cpp, and add an undo call.
In computeRowMetrics, the right margin of the row shall be taken in account when the text is not left-aligned. Rewrite the code in terms of the available width `w' to avoid this pitfall.
The pointer macroInset points to a vector element. When another element is inserted in this vector, some reallocation occur and the pointer points to a deleted element.
This does not crash LyX by default, but it is bad enough to make valgrind cry.
See ticket #9804.
There was a problem with end of paragraph markers. By design, wide insets choose their size without taking in account the marker. This should not lead to unneeded horizontal scrolling.
Part of ticket #9807.
PDF properties (Author, Title...) need to be quoted properly when writing (normal operation and tex2lyx). Also, reading them requires to use Lexer::getString() directly, because >> uses next(), which does not handle escapes.
Fixes bug #9830.
hyperref expects LICR macros for non-ASCII chars in the PDF Header Information.
As hyperref provides good coverage for \inputencoding{utf8}, we try
this if the current input encoding does not support a character.
With XeTeX, we do not load inputenc and cannot use \inputencoding.
However, utf-8 works out of the box so we can write the content in UTF8.
The \jobname macro is redefined for the preview snippets such that
it contains the name of the document without extension. This is
harmless because the moment it is redefined, TeX has already chosen
the name of the output and log files. On the other hand, any use
of \jobname in preview snippets is now consistent with what one
obtains after exporting and compiling by hand.
Other than BIBINPUTS, also BSTINPUTS and TEXFONTS are exported.
They do not replicate the setting for TEXINPUTS but are set such
that the current dir (i.e., the temp dir) and the document dir
are also searched for bibtex and fonts related files.
The code in InsetTabular disables the toolbar icons and menu entries related to vertical lines.
The code in GuiTabular disables vertical lines in the Settings dialog.
Note that there was a bug in
GuiSetBorders::set(Left|Right|Top|Bottom)Enabled, where the borders
did not get drawn correctly.
Fixes bug #9816
Rewrite the logic completely:
* fix cases where the offset was reset unnecessarily
* fix cases where the row was scrolled too much: as soon as a side of the row is completely visible, there is no need to scroll more.
* fix cases where offset would never reset
This partially reverts commit 0f1fdaaa9, but only redraws the current
row when the value returns by getPos is obviously false. It would also
be possible to check whether the current cursor has all its insets in
cache instead.
A better fix should be found, but this is unfortunately not 2.2 stuff.
Fixes bugs #9796 and #9812.
The execution took some time and the messages were delayed
until all test files were processed. Now as each testfile
is processed, the appropriate messages are printed.
There is also a new target: cleanupdatetex2lyxtests
It is the same as updatetex2lyxtests, but removes also
some extra created files from the source directory.
Cmake versions prior to 2.8.11 don't know this command, but
our minimal requirenment is 2.6.4
Thank to Vincent, it is replaced by using 'if(file1 IS_NEWER_THAN file2)' comparision.
Sometimes when compilation fails a PDF file is created but is empty
and the viewer gives an error when trying to view it. One such
example is compiling the current lib/examples/PDF-comment.lyx file
with TeX fonts and the following version of LuaTeX:
beta-0.80.0 (TeX Live 2015) (rev 5238)
The wordSpacing property of a QFont object applies only once when there are multiple spaces between words. Therefore Row::Element::countSeparators shall not count spaces, but groups of spaces.
Fixes bug #9808.
This is a tiny simplification that makes understanding the code more easy and
will help in fixing the remaining regressions. The logic remains the same, no
export test result is changed.
Starting with Qt 5 the modifiers aren't reported correctly for disabled swap.
Until this is fixed it is corrected by reverting the modifier mask to check for.
The horizontal alignment changes caused a regression for documents in older
formats. This could have been fixed by adding the following lines to the
format entry for 489 in development/FORMAT:
Previously, the horizontal position was ignored except for the
following parameter combinations:
- fixed width and type Boxed and without inner box
- fixed width and any type and with inner box and with makebox
Now, it is also used for the parameter combination below:
- makebox is not used and not (type Boxed and without inner box)
and a corresponding conversion to convert_BoxFeatures() in
lib/lyx2lyx/lyx_2_2.py. However, it was decided to revert the box alignment
changes instead: The box alignment can contradict the paragraph alignment. A
better way to avoid the additional space that can be created by paragraph
alignment (which was the motivation for implementing box alignment) is the
same as for table cells (see noTrivlistCentering() in src/Paragraph.cpp).
This would be a file format change and it is too late now for 2.2.0.
See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg188147.html for the
complete discussion (subject "Regression in lyx2lyx box alignment").