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").
Fixes output for 3 of the 4 test lyx-files.
Includes "FIXME"s at places where further action is required to get the XeTeX
export right but I don't know how.
Remove member disp_ that is defined both in Cursor and CursorData classes
Pass parameter of convert<T>(docstring const) templates as const reference for performance.
b1c68dccf8 and 46aed6d2b9 fixed some language nesting issues, but introduced
a regression for the case that there is a standard paragraph in a foreign
language, followed by a list (e.g. itemize) in the same language, followed
by the end of the document, as e.g. in lib/doc/de/Additional.lyx. The reason
for this was that not all language ending commands did reset
state->open_polyglossia_lang_ correctly.
I am sure that one can still construct broken corner cases, and I am also sure
that this was already possible before b1c68dccf8 and 46aed6d2b9. However,
this fix seems to fix the most important issues, and to get nesting completely
correct we would probably need some stack-like structure, for languages and
encodings, also for the CJK part (which is not touched at all by this commit).
The correct mappings break the tex2lyx roundtrip tests because both,
the tests and tex2lyx use the wrong mapping (\b for "combining minus below").
Fix tex2lyx and the test files so that round-trip tests pass again.
The culprit was that the computation of textwidth did not take wordspacing in account.
Also fictor the code so that the pixmap path can use the special RTL handling.
It is not clear however that the handling of left and right bearing works correctly.
We already have a CoordCache of insets dimensions. It is not necessary
to store the same information in two places.
Give a name to CoordCache tables types to improve code readability.
Remove ParagraphMetrics::singleWidth, which is not used anymore.
Please use the new function otexstream.append(str, texrow) to append an
odocstringstream with texrow information to the output when outputing to a
string buffer (e.g. case of subcaptions).
This deep copy used to mess with the unique identifier: what TexRow saw was
different from the original uid. There may also be performance improvements.
(Using Georg's suggestion)
These features are active in DEVEL_VERSION when Debug is set to LATEX.
1. The TexRow information is prepended to the source panel.
2. Clicking on any line in the source triggers reverse search. (This would be an
interesting feature to implement on the user side, but we need a proper LFUN.)
WriteStream is now built from an otexstream instead of an odocstream, and
therefore counts lines in a TexRow. Calls to TexRow are added in relevant places
in math insets.
This finishes adding line tracking for math in the source panel and for forward
search.
This is preliminary work for extending the cursor<->row tracking to math.
TexRow used to associate, to each row, a location id/pos where id determines a
paragraph and pos the position in the paragraph.
TexRow now associates to each row a list of entries, text or math. A math is a
pair uid/idx where uid will determine a math inset and idx is the number of the
cell.
The analogy id/pos<->inset/idx works better than the analogy id/pos<->idx/pos,
because what matters for the TexRow algorithm(TM) is the behaviour in terms of
line breaks.
This only improves the source view and the forward search, not the error report
and the reverse search (though this could be easily added now).
The id is just the memory address.
The status bar now spits out the math inset uid information when in a math cell
in DEVEL_VERSION, like it already does when in a paragraph.
This is preliminary work for extending the cursor<->row tracking to math.
otexstream used to count lines to build a TexRow, and some other things. The new
class otexrowstream has the line counting feature of the previous otexstream
without other stuff. otexstream is now a subclass of otexrowstream that has the
same features as before.
This is preliminary work for extending the cursor<->row tracking to math.
The code that sets open_polyglossia_lang_ is not only executed for polyglossia,
but also for babel, so we have to use the correct language end command.
The context menu did no longer work for some insets, since it requires the
cursor to be in front, and editXY() is also used to determine the inset for
the context menu. Now the cursor is corrected if needed.
This was made visible by aab1b145a5, since xhtml export for
lib/doc/Additional.lyx caused an exception. However, the cause for this was
already present earlier: All attempts to output a std::string to an
odocstream resulted in trying to change the encoding of the stream instead,
since there is no operator<<(odocstream &, std::string) defined, and an
implicit conversion to SetEnc happened instead.
This is fixed by making the SetEnc constructor explicit and adjusting all
code parts that did not compile anymore after that. The parts of the code
that did use the wrong output operator were the std::string version of
htmlize() from output_xhtml.cpp and all changed parts in the other .cpp files.
I also removed the std::string versions of html::htmlize() and
html::cleanAttr(), since it was difficult to see which encodings were used
with these. Now we are always explcit when using html::cleanAttr() and
html::htmlize().
Previously, if one clicked onto a large non-editable inset like the new LyX
logo inset, the cursor was always positioned in front of the inset, even if
the click was almost at the back edge. Now the cursor is positioned at the
correct edge. I tested this also with RTL contents, where from means right
and back means left, but the inset anchor position anchor point is still
at the left, and the right edge is dim.wid pixels to the right of it.
The rule-of-three says that if any of virtual destructor, copy constructor
or assignment operator needs to be manually implemented, then all three
should be implemented. Otherwise you can get subtle bugs which can be
difficult to find. In the changed classes, changing a copy-construction to
an assignment would have had surprising effects. Now they all behave
consistently.
Found by cppcheck: (style) Same expression on both sides of '&&'.
I deduced the correct if-condition from the other places where theLaTeXFonts()
is called.
These were found by cppcheck:
Member variable 'x' is not initialized in the constructor.
The crash #9788 would not have happened if this had been done earlier.
The test case did show several problems:
- The alignment argument was not parsed correctly if it was not in braces
- There one column too much created, since I did not take into account that
the current cell must bge replaced by the multicolumn cell
- If the last line of an array contained only an empty multicolumn cell, then
the complete multicolumn was swallowed
- The decision whether to output the column separator & was sometimes wrong
for multicolumns
This fixes the crash of bug #9788. However, the misparsing of \multicolumn
is still there: LyX thinks that the array has three columns, it inserts an
additional one before the multicolumn.
This was a regression from 2.1.x. I failed to copy the horrible hack that was present for the special case of () in Hebrew.
There is a real need for someone who understands RTL language stuff to fix this. Currently () are wrong in .lyx files IMO. We should not have to swap them for display.
This removes the old implementation of Cursor::getSurroundingPos, that has been superceded in commit .
As this was the last user of the Bidi class, this can be removed too.
Use the function support:truncateWithEllipsis() to shorten a docstring with
... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when
automatically shortening strings. This is to be consistent with Qt's own
truncation and is much nicer on the screen.
This includes the bugs #9575 and #9572 regarding broken text elision in the
outliner.
Known issues (non-regressions):
* TocBackend::updateItem() should be rewritten to update all TOCs. (#8386)
* "..." should be replaced with … everywhere else on the interface (including
translation strings).
* We should prefer to rely on QFontMetrics::elidedText() to truncate strings
with an ellipsis whenever possible, or an equivalent for the buffer view
dependent on the font metrics. See the warning in src/support/lstrings.h.
* TexRow now computes rows from a DocIterator. In practice, the cursor
highlighting is now correct inside insets, it is no longer restricted to the
topmost level. It certainly also makes forward-search more precise.
* Added the option to disable a texrow when not needed, for perf.
* Fixed a bug where the last paragraph was not properly highlighted.
Limitations:
* TexRow still does not handle: math (e.g. multi-cell), sub-captions, inset
arguments.
* New TOC "math-macro". This means that math macros can now be accessed in the
outline pane in their order of appearance or in alphabetical order, and can be
searched using the filter.
* Lists of floats now show subfloats deeper in the navigation menu
* The arbitrary 30 element cut-off after which nothing is shown except "Open
Navigator..." is removed. Menus now have no limit in size, so Qt may display
them scrollable. In exchange, we always show "Open outliner..." at the
beginning. I tested for performance issues with a rather complex document and
it is fine; but this does not exclude corner cases with lots of TOC entries of
a certain kind. If necessary, populating the navigation sub-menu should be
delayed like the main menu.
* Elements that do not contribute to the output (e.g. in a note, a disabled
branch) are now preceded with a symbol indicating this status. (The machinery
was already there; I wonder why it was not implemented already.) I have chosen
U+274E NEGATIVE SQUARED CROSS MARK.
* Fix the contextual menus in the outliner (bug introduced at 94e992c5).
* Toc item now move to the caption when present, but first center on the float,
to prevent the situation where the caption is at the top of the screen and the
contents of the float is off-screen above the caption.
(Internally, the action of the toc items can now be customised)
* Fix the LyXHTML output. Disabled captions no longer appear in the list of
figures.
Remove unwanted clearSelection()s in MathData::updateMacros(). These calls broke
text selection with keyboard and mouse, search-and-replace, restoring selection
after Undo, etc. in a document with math macros since 1.6.0. (Regression at
6aa54673 and 12314897)
I do not know the purpose of these calls, but the selection code has been worked
on since, and I cannot produce undesired behaviour after removing
them.
New method TextMetrics::findRowElement, excerpted from CursorX.
Reimplement getSurroundingPos using Row information. This is easy when
the cursor is inside a row element. At row element edges, different
situations can occur; hopefully all these situations are taken into
account.
Rename the old getSurroundingPos to getSurroundingPosOrig and
transform getSurroundingPos into a wrapper that compares the two
methods. This will be removed when we are confident that the new
function is equivalent to the old one.
It will then be possible to remove also the Bidi class (at last!).
There are still a few warnings of the kind
(style) Variable 'x' is assigned a value that is never used.
since I did not touch code where I was not sure whether there might be a real
bug, and I kept some for symmetry reasons as well.
This fixes cppcheck warnings (style) 'class x' does not have a copy constructor
which is recommended since the class contains a pointer to allocated memory.
These were all flagged by "(style) The scope of the variable 'x' can be reduced."
Narowing the scope improves readability, and if it is in a loop then the
compiler will be clever enough to produce efficient code, we do not need
manual optimization for POD types.
As Günter found out running the tex2lyx tests overwrites the test references
if the build directory is identical to the source directory. Therefore the
tests would always pass, but git diff would show a non-empty diff if the tests
should have failed. Since it is better anyway to build in a separate directory
we simply do not support srcdir = builddir for the tests and abort with an
error.
This generalises the new use of TocBuilder (97e8101) to listings and wraps and
removes some duplicate code.
Make sure that we will never write an empty float type again in the future
(#9760)
We introduce TocBuilder for building TOCs that take into account both float
insets and their captions.
* Floats without caption are shown with their content.
* Floats with a caption are shown with their caption, but clicking the entry now
correctly moves to the float and not to the caption.
* Subsequent captions produce additional entries in the TOC.
* Figures and subfigures are correctly ordered in the outliner.
* New TOC "senseless" for captions appearing alone (a bit like broken references
are still displayed in the menu and outliner).
* Disable LFUN_CAPTION_INSERT if there is already a caption in a listing
Known issues:
* Inconsistent output for includes located inside floats
* We should record the end of the float in addition of the beginning for a more
accurate cursor -> outliner entry conversion
(#9762)
* fixes a bug where this was already the expected behaviour of
math-subscript and math-superscript but failed.
* corrects the behaviour where if there is \newcommand in the
selection, then a corresponding macro template is introduced
instead of a math inset.
* fixes a bug where math-display, math-subscript and math-supscript
would also introduce such a macro template in a way unrelated to
their function. Now it only happens with math-mode without
arguments.
* fixes a bug where a text that does not denote a macro definition,
e.g. "aaa\newcommandaaa", would produce \invalidmacro.
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
The old code produced crashes with gcc5 caused by calling the copy
constructor (see https://bugzilla.redhat.com/show_bug.cgi?id=1260976).
This has been filed as gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67557
It is currently being marked as invalid (they claim the code is not valid and
produces undefined behaviour), but I don't think that this is correct.
Fortunately i does not matter for us whether the old code was valid or not,
since the new version is easier to understand and works with all compilers.
Base classes with virtual methods should have a virtual destructor.
See Scott Meyers, Effective C++ item 7: Declare destructors virtual in
polymorphic base classes.
Fix bugs #6501 and #7359.
* Selection highlighting has been broken since a conflict with
reverse-search was repaired (at 00a62b7c), is now fixed.
* The selection highlighting was not accurate, for LaTeX formats (in
full source view), and meaningless, for non LaTeX formats.
* fix regression at cc00b9aa: force_getcontent_ was always true
therefore the code to detect changes in the generated source was
dead. The consequence is that the source view would jump to the
beginning at each updateView() even if no change occurred. Cc00b9aa
was meant to fix#5600, which I cannot reproduce with the new
implementation.
* Various improvements:
* When the position-to-line conversion is unavailable (LyXHTML, LyX
source, etc.) we focus on the first difference instead.
* Get some space around the cursor
* Respect the scrollbars
* Highlight with QTextEdit::ExtraSelections instead of cursor
selection (the latter used to break syntax highlighting of the
TeX code... which was not so much of an issue before because the
wrong part was selected)
Known issues:
* The highlighting is off by one line in very last paragraph of a
document. This appears to be a bug in TexRow.cpp.
* The highlighting is off for any kind of inset. This could be
solved by adapting TexRow so that it accepts CursorSlices as
and argument for the conversion to line number. (this is bug
#4725)
Fix bug #9493. The source panel was very slow with auto-update on. Now
we use a timer that ensures that the source is generated only at
rest. The delay is short or long depending on whether we show the
source of a paragraph or the whole source.
In order to adjust the path of an included file, when deciding
whether the document was moved or not, it is not sufficient
comparing the paths because the document could have been accessed
through a symbolic link.
This was a regression of 0c093a6264. The crash was found by the tex2lyx
test case test-insets.tex: Running lyx -f main -e pdflatex test-insets.lyx.lyx
did crash. This is not a real fix, but will do for now since previews are not
needed in command line mode (I wonder why they are generated at all?) In the
long term, we need theApp() to return a console application in commandline
mode to eliminate the existing sifferences between export from GUI and
commandline.
* Omit commented-out lines
* Properly escape backslash
* Do not allow non-space chars after delaration
* Allow blanks before # comment character
Fixes: #9746
Greek and Times under MikTeX with auto-install may fail due to a half-installed
font package. However, the workaround in LyX stands in the way of
alternative approaches (see bug #6469).
This function inserts a COMBINING GREEK PERISPOMENI character that is
normalized to pre-composed characters for base characters where a
corresponding WITH PERISPOMENI character exists.
This is a partial solution for Ticket #6463.
When a row is too large due to a wide inset, it does not make sense to
break text before if the problem is the same in the next row.
Therefore give up breaking in this case.
Note that this was explicitely taken care of in the old-world
rowBreakPoint code.
Fixes bug #9691.
This is done only inside LFUN_BUFFER_VIEW_CACHE so as to preserve
the benefits of caching in other places.
Without this commit, if a converter or a user (re)moves the preview
file and then calls buffer-view-cache LyX will launch the viewer for
a file that does not exist.
For a discussion and use case, see:
https://www.mail-archive.com/search?l=mid&q=55D393D7.6050403@lyx.org
Both \origin and \textclass tags may be paths and contain spaces.
In this case, enclose them in double quotes such that they can be
correctly read by the lexer.
This solves a few bugs related to the font not being set correctly.
For example, when putting a selection somewhere with
putSelectionAt(), the font was not reset so that before this commit
if the cursor was in an ERT, strange things could happen.
putSelectionAt() is notably used when highlighting the location
corresponding with a LaTeX error (GuiErrorList), when using find,
and when using the spellcheck. I could reproduce the bug using all
three of these.
Bug #9500 is an example of the type of bugs that this commit fixes.
Instead of remembering the last breakable element in the row, search
backward in the row and consider all string elements one by one until
a correct place to break is found.
This fixes the case where the row ends with a string, but there is no
space soon enough in the string to break it here. In this case, we
need to consider the previous row.
We have been here before. The png files are generated, but then by the time we preview the document, they are gone. This is because (a) when the PreviewLoader for a Buffer is deleted, it removes all its previews and (b) we export in a clone, so that Buffer gets deleted before the preview is actually shown. So we need to check whether we are a preview for a clone before we delete anything.
The first change is to concentrate on the last ro elements that contain separators and try to break it a a width that is shorter than both
- its current width (we want to break it, after all)
- the amount of space available.
This simple heuristic seems to give good results.
With this patch, the cursor position before undo can be saved when
creating an undo group. Any such value will supercede parameters
passed to recordUndo. Only the first such cursor set by nested
beginUndoGoup takes effect.
Fixes bug #9663.
If keymaps are activated and there is a secondary keymap but no
primary one, then the pointer to the active keymap was 0x0. This can't
be good.
Fixes bug #9685.
When entering an inset from the keyboard, setCurrentFont()
was not called and thus the cursor retained the font that was set
before. This could create strange behavior that could often go
unnoticed by the user.
It is easy to imagine many other situations similar to #9597 where
the user could trigger this bug.
Fixes bug #9597.
* GuiFontMetrics::pos2x, x2pos: add support for inter-word spacing.
* GuiPainter::text: idem
* Row::Element::countSeparators:
Row::countSeparators: new methods that count spaces in strings.
Row::setSeparatorExtraWidth: new method (code lifted from TextMetrics.cpp).
* TextMetrics::computeRowMetrics: rely on the above methods.
* RowPainter::paintMispelledMarked: pass only a Row::Element object reference
RowPainter::paintStringAndSel: idem; do not rely on values returned by
Painter::text (trailing spaces do not honor wordspacing value).
The goal of this commit is to make painting faster by reducing the
number of strings to paint. To this end, it is necessary to include
spaces in row elements.
Also importantly, this commit should fix existing problems with line
breaking in chinese text.
* TextMetrics::breakRow: do not do anything special for word separators.
* Row::add: when adding a character to a row element, keep the string
width updated. If need be, it is possible to tweak this by updating
every 10 characters, for example.
* GuiFontMetrics::breakAt (new): use QTextLayout to break text either
at word boundary or at an arbitrary width.
* Row::Element::breakAt: use the above method.
* Row::shortenIfNeeded: simplify now that because there is no need for
handling separator elements. This will be taken care of by the
improved breakAt.
Two things remain to be done:
* remove all traces of separator row element
* re-implement text justification.
Actually photos (i.e. .jpg files) where supported previously, but for pdflatex
output an unneeded conversion to png was done. The RasterImage templates
behaves now exactly as InsetGraphics for these files: If the input format is
jpg, use that for pdflatex, else convert to png.
When adding units to the external inset bounding box I overlooked that
InsetGraphics supports only bb, cm, mm and in. Therefore I added too many
units for the external insets. We are not as strict as the graphics inset
and allow all absolute units, but no relative ones.
In breakRow set left and right margin properly for RTL paragraphs.
Remove corresponding code from ComputeRowMetrics.
In row painter, check the use of left and right margin depending on
context. The problem in the original text is that the various
leftMargin() methods actually represent right margin for RTL
paragraphs. This should be fixed eventually.
This made text in smallcaps+emph display as upright instead of plain
emph. There is no latex font for smallcaps + emph, but it is not a
reason for displaying it wrong.
There are many things that are not necessary anymore:
* remove methods paintText2, paintFromPos, leftMargin, paintInlineCompletion
* Remove use of Bidi class.
* add a Font and a Change parameter to paintInset.
Also remove a comment that describes what we have just done.
The new version of paintText is quite short. Elements are treated one
by one. They are already in the right ordering.
The other changes are:
* a new paintChange method is added (using code lifted from old version)
* in paintLast, the support for end of paragraph markers is removed
(this is already part of the Row object.
This path configuration variable is used for user defined location.
There are other possible places for the thesauri like mythes installers or bundled with LyX.
This brings the external inset on par with the graphics insets as far as the
clipping option is concerned. The graphicxs package supports both: A bounding
box without units (which means that bp ia assumed), and a bounding box with
units, so we can simply output the values including the units.
Being able to compile document with zipped .eps files was a useful feature of
the graphicxs package 20 years ago, but the LyX support is no longer relevant:
- The flag is ignored if preview is on
- If pdflatex is used then uncompressing happens during the compilation anyway
- If set, the flag prevents LyX from issuing proper error messages if
something with the image is wrong
- For hard disk capacities from 20 years ago not uncompressing is a useful
feature, but for current hard disk capacities it does not matter
- The external inset does not have it, and if we want to merge both insets
one day we would need to implement it there, which is even more difficult
than in InsetGraphics
The functions reverseDirectionNeeded() and reverseDirectionNeeded() do
not rely on the Bidi class. The first one is changed into a Cursor
method, and the second one is replaced with explicit code.
Since commit 7ac70092, lyx::dispatch returns a DispatchResult const &,
which is ignored in the cases below. Nevertheless, the windows
compiler complains that it does not know this type. Gcc and clang can
deal with it without problem.
The bug workaround added an extra repaint, which can be very bad when
editing large tables.
It turns out that the bug this is trying to fix is due to the handling
of LFUN_LINE_END in InsetMathGrid. Adding the same code as in
InsetMathNest fixes the problem.
The workaround can therefore be removed.
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.
* make lyx::dispatch return a DispatchResult struct
* there is a new MINIBUFFER type of toolbar, that can be used for this use.
* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.
* when minibuffer toolbar is "auto", make the toolbar close itself after
- a command has been executed without error
- an empty command has been executed
- the Escape key has been used
[this is actually commit fdcff02a, which was later reverted at dd61d8cf]
There is a mismatch between the way text is tokenized in Row objects
and the way it is shown on screen. When metrics are computed,
continuous spell checking has not been done yet. Yet, the row painter
explicitly breaks words at spell status boundaries. This creates
problem with a text like "PMP," (see bug #9649), where there is a
negative kerning before the comma.
This is solved by not taking in account spell status when drawing
text, and drawing spell underlines separately.
* replace Paragraph::isSameSpellRange with new method getSpellRange.
* merge RowPainter::paintChars into RowPainter::paintFromPos
* move the actual text painting code into the new paintTextAndSel.
* merge some code from paintFromPos to paintMisspelledMark
* in paintMisspelledMark, scan the string which needs to be annotated
and add dashed line below text marked as misspelled.
Fixes bug #9649.
This avoids warnings with windows compiler. It is a pity that even
clang does not give those. Maybe I missed them with the large amount
of boost warnings that it spits.
There is a second solution in the code which uses some undocumented Qt
stuff, but it does not work in some cases. The best is to rely on the
documented way.
There is no need for real-valued line width in painters. Actually, this even leads to uneven dashes for continuous spell checker.
The new code is supposed to be equivalent to the old one, just more readable. From this, we can try to see whether some lines need to be made thicker on HiDPI screens.
Length::inBP() returned the wrong values for most units. I guess that this was
caused by the default case in the switch statement: It did probably exist
before the other units were added.
inBP() is now correct for all units except the font dependent ones em, ex and
mu and the percent units: For these only approximate values are returned,
since not all needed information is available.
LaTeXFeatures defines \textcommabelow and \textcommaabove based on a
generic \LyXTextAccent and declares TextCompositeCommands for the Baltic
letters in the T1 font encoding, using \textcommaabove for the small letter g
and \textcommabelow else.
This allows overwriting of the composite definition for other font encodings.
Especially, it does not interfere with the polish/baltic font encoding L7x
(supported by LatinModern and TeXGyre fonts) that provides pre-composed
glyphs.
Greek characters with perispomeni (tilde) accent were not properly shown
in the output document, because the "textgreek" feature re-defined \~ in
a way incompatible with lgrenc.def since version 0.8 (2013-05-13)
(package greek-fontenc).
The compatibility-definition is required for older versions of the font setup
(before the move of "lgrenc.def" from "babel" to "greek-fontenc").
It is now done with "ProvideTextCommand" to not overwrite the more complete
implementation in lgrenc.def.
With the compatibility definition, combined diacritics with tilde
must be input with the tilde first (e.g. \~>, not \>~).
"unicodesymbols" is changed accordingly.
Also, some LICRs for combining Greek diacritical characters were added to
Unicodesymbols.
When the cursor had idx > 0 (since math-display does merging anyways),
reset cursor to the start of the inset. This looks less strange than
setting it at the end.
Now at least the basic case of a displayed equation with cursor
somewhere at top-level is handled correctly.
The math-display lfun operates at top level in the math inset.
Therefore, when the cursor is in an inner inset, it will after the
lfun be moved at top level. Unfortunately, there is no way that I know
f to detect this in Inset::doDispatch.
Even if we could, as things stand, it is difficult to keep the cursor in the
inner inset, especially if the inner inset moves : this happens for
example when moving from eqnarray to inline maths.
Therefore this fix is the best I can think of now.
Fixes part of bug #9664.
Both marvosym and bbding define the "Cross" macro.
To prevent a compilation error due to conflicting definitions,
we undefine the "Cross" macro if both packages are required.
It turns out that it is always better using the copy of the MacroData
for updating the macro_ pointer to avoid problems related to the cursor
position.
This effectively makes the horizontal size policy "minimum", which
makes it clear that there is no advantage for this widget of
increasing the horizontal size past the minimum, allowing other
GUI elements to use the horizontal space if useful.
This change for caseCB is consistent with wordsCB and searchbackCB.
This can happen when a macro is copied and then the document where
it is defined is closed. In this case, the macro survives in the
cut stack but the the buffer pointer is dangling.
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.
* make lyx::dispatch return a DispatchResult struct
* there is a new MINIBUFFER type of toolbar, that can be used for this use.
* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.
* when minibuffer toolbar is "auto", make the toolbar close itself after
- a command has been executed without error
- an empty command has been executed
- the Escape key has been used
The 'using namespace std' at the top of the file makes it quite difficult to
understand which abs is used: double std::abs<double>(double) or
int ::abs(int)? Now it is explicit, and the code does not change in subtle
ways if somebody removes the using statement.
The horizontal size policy is now set to "MinimumExpanding", which
means that sizeHint() is enforced as a minimum, but that the widget
can make use of extra available space.
Before, the size policy was ignored, and often resulted in a
scrunched pane that had to have its size manually increased.
The symptom of the bug is that the preference could be incorrectly
displayed (based on the value of the statusbar preference).
This seems to have been a copy/paste mistake introduced in 214f7ed2.
The MacroData pointer is updated by MathData::metrics() which is not
called when selecting a math inset with instant preview for math on.
Thus, we have to update it in the copy constructor otherwise a crash
is almost assured when hitting Ctrl+C.
If latex fails to generate any output, the forked process was not removed.
Now, if a snippet was changed a new one was started but, if also the zoom was
changed, things went awry because the 2 concurrent processes were asked to
process again the same snippet. Previously this would have simply caused a
waste of resources because the changed snippet would have not been regenerated.
Also reset the guard due to the early exit.
If the zoom factor is changed right while the previews are being
regenerated, the refreshPreviews() method is a no-op. So, reschedule
the refresh until everything is ready.
Relying on the fact that the timer is not active anymore does not
guarantee that the previews at the correct zoom are ready because
the regeneration process may take several seconds and during this
time the zoom factor may be changed again. So, we need an additional
guard for assuring that everything has settled down.
We only look once for the definition of the same macro, but we have
to always check its arguments when the same macro appears more than
once in a math inset. So, move earlier this check.
The strategy adopted in bc47054b had some drawbacks related to the way
instant preview snippets are generated. See the subthread starting at
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187916.html
for details.
The strategy adopted in this commit is that of adding macro definitions
only for the macros actually used in a preview snippet, independently
of whether some macro was already used in a previous snippet. In this way
the snippets don't need to be changed according to whether they are
compiled as a whole or separately from each other. This fact was causing
the regeneration of a preview snippet whenever the cursor entered the
corresponding inset, even if the generated image would have not changed.
The problem of defining or redefining a macro is taken care by the
python scripts.
Unfortunately I overlooked in 44f73b0650 that the first three whitespace
changes in box-color-size-space-align.lyx.lyx were actually correct, so they
should not have been reverted. In detail:
1), 2): The space after \raggedleft must not be part of the ERT inset, but it
is ouput by check_space() as part of the standard text which follows.
3): The space in front of www is caused by the fact that there is a
newline between the opening brace of the parbox and the \centering
command, so this space is not the one after \centering (which is
correctly swallowed). This additional space is in fact not needed,
and the contents would look better in LyX without it, but since it is
not caused by special code I'll put it back in the refernce for now.
We can still improve this in the future if anybody has a good idea.
The remaining whitespace issues are all fixed by a simple change in
parse_text(): Instead of always eating whitespace after detecting \centering
et al, and always output a space as part of the ERT if these commands need an
ERT, let the standard space handling mechanism kick in: skip whitespace if
no ERT is used (in this case LyX will always output the needed space), and
do not touch whitespace if an ERT is used.
The FIXME is not needed, this is how StyleChanger and FracChanger work:
In the constructor, they change the state of the FontInfo, and in the
destructor the state is set back. Therefore, all code that needs the changed
state, needs to be executed while the objects do still exist.
Until now the regeneration process was starting as soon as the zoom scale
factor was changed. This was causing some glitches, especially if the zoom
was changed by the mouse wheel, as on each change the process was started
again and again making zoom changes painful and causing races such that
one could end up with the text at some zoom factor and the previews at
another one. After this commit, the regeneration is started only after
the zoom factor has been stable for about 1 second. In this way, one can
use the mouse wheel for changing back and forth the zoom factor at own's
heart desire without any slow down due to the regeneration process running
in the background. For those using previews with numbered math equations,
a nice possibility for getting the equations correctly numbered in sequence
(after removing or adding an equation) is using the shortcuts Alt+ and Alt-
in rapid sequence (less than a second between the keystrokes). Previously,
this would have triggered twice the regeneration, but now only once.
Currently, insets are notified that the cursor entered or leaved them in Cursor::dispatch. This is not the cas efor lfuns which are handled in BufferView.
Adding the proper code allows to fix many bugs where previews are not updated correctly.
This also reverts cf4f79f8, which was the same fix for a particular case.
Fixes bug #6173.
Other than checking that we are at the beginning of a paragraph,
we must also check that this is not the first paragraph before
triggering the code that removes the inset separator. This accounts
for the case that we are dissolving an inset from the inside.
Without this additonal check the old code was fooled into thinking
that the separator should have been removed.
The removed code was introduced at [c668ebf6/lyxgit] to assure that
an inset separator in the last position of a paragraph was getting
removed when hitting backspace with the cursor at the beginning of
the next paragraph. Apparently, it is not needed anymore and can
be removed. This avoids the reported assertion.
As JMarc notes on the ML, the referenced commit modifies a full
buffer just in the middle of a dispatch action.
Further, this commit lead to an assertion [1], although it is not
clear to me whether the root cause of the assertion is the commit
that is being reverted here, or one of the issues we have with
previews and macros.
This reverts commit 73460423ad.
[1] http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187921.html
Actually, the change is done only if the cursor language was the
document language already.
This fixes an trivial but annoying problem: create a new file (in
English), change language to your favourite language, then start to
write. Before this fix, the words come out in English, which does not
make sense.
Fixes bug #9586.
This is for people who cannot grasp the superior conventions of emacs ;)
A new argument "partial" has been added to word-upcase, word-lowcase
and word-capitalize that restores the old emacs-like behavior.
The (x)emacs bindings are updated to use the "partial" argument, and
also to bind correctly M-u and M-l (M-c is unfortunately not
available).
Fixes bug #2826.
* Provide for vector fonts only if needed.
* Make sure microtype doesn't throw a trantum in dvi mode.
* Use correct macro definition in preview insets.
if a specific one (such as en_NZ-v2.idx) is not found.
If someone can replace the rather clumsy code by an elegant regexp
(I failed to find one), this is most welcome!
These should not have been done without discussion.
- Removal of the dcolumn table in 1a8b74f5e1. Even if LyX does not support
dcolumn anymore, it is still a useful test whether tex2lyx imports it
correctly.
- Removal of the first "%% LyX" line. A long time ago it was decided (after
long discussion between at least Jean-Marc, Uwe and me), that this line is
interpreted by tex2lyx, and used to remove some LyX-generated preamble code.
These lines in the current tests exist on purpose (one can see in the diff
how the removal added unwanted stuff). I do not really like the
interpretation of the "%% LyX" line, but if this behaviour is to be changed
then this needs discussion first.
- Changed comment of \date. The comment was put there on purpose, and the
warning which was "fixed" by the change hints at a limitation in LyX, not a
tex2lyx problem (LyX does not know that a comment inset between some title
insets is OK). The roundtrip .tex output was OK with the old version.
- Change of \verbatiminput{foo}. This was supposed to test whether a
verbatim inset is correctly created even if the included file does not
exist.
- Removal of \lyxlines. Although these tests test input of files created by
old LyX versions, they are useful.
- Change of the lemma in test-modules.tex. The old version was put there on
purpose, and the file itself explains why it is translated to ERT.
The recipe for reproducing this crash is to do a search and replace
that changes a string present in a collapsed inset, and then undo.
This is a followup to 17e435c4, which used editable() instead of
isActive(); this commit was amended at c2f785bd, since editable() is
not set properly in mathed.
Truth is, editable() is not the right property to test against, since
it is false for a collapsed inset, which does not prevent a cursor
from pointing inside. Therefore sanitize should not change the cursor
in this case.
Hopefuly, this is the last word on the subject. Alternative would be
to drop this if()-clause completely.
The documents saved to the system directory have now the origin tag
prefix "/systemlyxdir/". This allows both saving them always using
the same virtual path irrespective of the real path and to let the
origin tag work out of the box also on MacOS.
There is a general problem of tex2lyx handling theorems. it is not sufficient to cure only one instance as I did. For more info see bug #9561.
Update the references accordingly.
With the now removed command we said that this is a file created by LyX but this is not the case
- also replace a comment to avoid LaTeX warnings about mixing title and non-title stuff
before LyX 2.1 was released the dcolumn support was dropped and another method was used to align at the decimal point. Nevertheless the old LaTeX table was even wrong in terms of dcolumn
Now a table is used that uses the decimal alignment as it is supported by LyX
The idea is to get a compilable file that does not require programs that are only available on certain platforms.
For example on Windows there is no Gnumeric available (only a very outdated and unsupported version with bugs).
there were 2 issues:
- the body was not output to the Preamble
- the theorem module already defines a theorem. It must not be output to the preamble to avoid a redefinition error of LaTeX
update the test files accordingly
Since lyX 2.0 we support to use the in_preamble tag. This allows to support more commands. For an unknown reason I forgot the jss.layout when I updated the other layouts once.
Fileformat change
A new preference is introduced for allowing the record of the document
directory path in the saved file. Without explicit consent, it is not saved.
If the origin tag contains an invalid/wrong path or garbage, LyX behaves
exactly as before, i.e., included files are simply not found.