This patch simplifies and fixes the generation of previews with
numbering. Instead of saving the counter values (which is complicated
and error prone), the \thequation macro is set to the numbers_ string
which has been computed by updateBuffer for screen display.
Harcoding the number in the formula means that two equations with
different numbers have different previews, which is the subject of the
bug.
The special code for saving counters in updateBuffer and putputing
them in preparePreview from 645f9fdf (ticket #6894) is removed and
replaced by this simpler approach.
This fixes ticket #11535.
The module subequation allows to number equations in the "Subfigure"
inset to be numbered (1a), (1b), (1c), etc.
To implement this on screen, we need to redefine temporarily the
"equation" counter to use this different numbering.
To this end, implement Counters::copy method that can be used to
backup full counter definitions.
Fixes bug #12567.
The layout from the paste content is adopted only if
- the paragraph is empty (ie. empty after the selection has been
erased) and Standard or Plain Layout, or
- empty and multiple lines are pasted, or
- multiple lines are pasted at the beginning of a paragraph
As for what other applications do:
- MS Word decides the adoption of a layout depending on whether the end of line
character is copied
- Libre Writer adopts the paste content layout only if the paragraph is empty
(otherwise it makes *all* pasted paragraph the target layout)
In LyX, as in Libre Writer, one cannot copy the end of line character by
selecting a single line. However, the Libre Writer solution is problematic
because one always has to make sure that a paragraph is in Standard layout if
one wants to paste several lines with their source layout. The implemented
behaviour differs from Libre Writer in that the source format is kept when end
of line characters are pasted, i.e. several lines are pasted, and hence does
what MS Word does in that situation.
Fix for bug #11023: Copy and paste from one list into another often leads to
undesired result.
Introduce the new FileName method ensureExtension, which does the following:
* if the extension is already correct (in a case-insensitive way), do nothing.
* if it is not correct, add the extension to the file name.
This is different from changeExtension that will fail in a case where
the file contains dots, but not a real extension, like newfile2.1.
Use this new method in renameBuffer() and exportBufferAs().
Fixes bug #11008.
This requires to add a parameter to GuiToolbar::addItem so that it is
possble to make a difference between toolbar buttons and menu items.
The long-term solution is to rely on the menu backend for such things.
Fixes bug #12004.
There are several small parts that are needed here:
* Implement LayoutModuleList::asString() that returns a comma-separated
list of modules.
* in Converter::convert(), handle the new tokens $$c for the current
textclass and $$m for the list of modules.
* in Buffer::importFile(), pass the current buffer as parameter instead
of nullptr.
* in pasteClipboardText(), copy the parameters of the current buffer to
the internal one used for importation, so that the textclass and
modules information is available to convert().
* finally, modify configure.py to pass "-c $$c -m $$m" to tex2lyx for
the latexclipoard->lyx converter.
Fixes bug #11312.
In Advanced Find and Replace, Tab can be used to move the focus from
Search field to the replace field. This is inconvenient when Tab has
another use, like completion.
To fix this, check that the function bound to Tab is disabled before switching focus.
The same is done for BackTab.
Fixes bug #11114.
The removal of duplicates is done in LastCommandsSection::add and uses
the erase-remove idiom for performance.
Most of the patch is a cleanup of GuiCommandBuffer:
* remove history_ member, that was a copy of the session lastcommands
vector. Use instead a wrapper history() around it and a addHistory
wrapper for adding new entries.
* Make sure that there is only one place where commands are added to
history. The code used to maintain a list for interactive editing,
and a list for saving the session. They could be different in terms
of leading/trailing spaces.
* [unrelated] remove command_ member, which is just a copy of
LyXAction list of commmands. Use directly lyxaction instead.
In mathed it is assumed that a labeled line is also implicitly numbered.
However, latex allows to label an equation without numbering it.
The label is then assigned the value of a nearby numbered one.
This commit drops the above mathed assumption in order to allow to import
valid latex code with a labeled but not numbered equation line.
The screen representation omits the line number and encloses the label
in square brackets for further differentiation. However, it is still not
possible to label an equation without numbering it using the GUI.
The aliases are defined by a file in the (system or user) image
directory. The format is pretty simple: each line is like
<str1> <str2>
Where every instance of <str1> will be replaced with <str2>.
Fixes bug #12509.
Adding this particular line created bad redraw interactions. See
thread on lyx-devel here:
https://marc.info/?l=lyx-devel&m=165648365808777&w=2
The code is reorganized a bit:
- the part of updateGUI() that (en|dis)abled elements is not moved to
updateBottons ; the rest is renamed updateWorkAreas()
- only updateButtons is called now in eventFilter
- finally the recursion curse is fixed now in updateWorkAreas() by
setting the old_buffer value _before_ calling copy_params. This
avoid recursion if some bad update were to happen again.
When changing the document class, the message "Converting document to
new document class..." is shown in minibuffer. This message leads to
weird GUI update interactions with the FindAndReplace panel, and
ultimately infinite loops. It would only be useful if the conversion
took a long time.
See this thread for rreference:
https://marc.info/?l=lyx-devel&m=165648365808777&w=2
Therefore, just remove it.
This important part is the last point, the rest is what is needed to
make it happen.
* implement (FindAndReplace|FindAndReplaceWidget)::hasWorkArea, that
tell whether a work area is own by the advanced find & replace
widget.
* factor out method find() from GuiView::findOrBuild.
* implement GuiView::hasVisibleWorkArea, that tells whether a workarea
is visible in the view (current tab in a split or adv. f&r
workarea).
* Finally, in TocWidget::sendDispatch, change the current workarea
temporarily to the document workarea before dispatching the
function. The code tries to be as careful as possible to handle all
cases. The future will tell whether it is good enough.
uf8x is not recommended
(https://github.com/latex3/latex2e/issues/833), and thanks to Europe
CV's recent release, is no longer needed. See here:
https://github.com/gsilano/EuropeCV/pull/30
Europe CV still fails on an updated TeX Live (see discussion on
hooks in the above discussion for why), but this commit at least
fixes the unicode-related errors.
Our template was already marked as "Obsolete" since the class does
not appear to be maintained. The recent LaTeX2e update triggered a
problem in the .cls file that seems unlikely to be fixed.