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.
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.
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.
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.
When the commit string from the inputMethodEvent can be interpreted as
characters bound to some action, dispatch this action instead of
inserting the string.
This is useful on an international keyboard, when diaresis+space gives
a plain double quote. It is better in this case to enter a smart
quote.
Adapted from a patch from Daniel Ramoeller <d.lyx@web.de>.
Fixes bug #10377.
Fix for bug #12547.
- "Interword" becomes "Normal"
- "Protected" becomes "Non-Breaking"
Plus a minor fixes to the "Horizontal Space Settings" dialog:
- Indicate that when "Non-Breaking" is disabled, the space will be non-breaking
When implementing multi-row string breaking, an extra createLine()
statement, which made sense in the original code, was kept by mistake.
This basically made the mechanism ineffective, because it created one
row with the correct length, plus a second one with all the remaining
text, which would have to be itself broken. This went undetected
because the display is still correct.
Additionally, this issue polluted the break cache to the extent that
the hit rate could be 0%.
Together, these two effects created a major slowdown with a document
containing a single ~30000 characters paragraph.
Fixes bug #12534.
With the debug-level 'find' there are now less output.
The original output can be received now with debig-level 'findverbose'
Also constructions like
LYXERR(Debug::FIND|Debug::FINDVERBOSE, "...");
are now possible.
It is not a good idea to contruct a QChar from a char_type that is
really 32bits.
Use lyx::isSpace, which already catters for this case.
Since this code does not depend on qt anymore, move it to
support::countExpanders.
Get rid of Row::countSeparators, which is not used anymore.
Fixes bug #12519.
Fix for bug #12456.
The labels are transmitted from Buffer to GuiRef by reference of refs_
in the getLabelList function. Previously, only one string was
transmitted. But I needed both the formatted string, e.g. "x enu:test"
or "Missing: enu:test", as well as the plain label, e.g. "enu:test".
The former is for the list of labels to choose from in GuiRef and the
latter for the label as shown in the line edit that contains the plain
label in order to create a new reference from it. Transmitting both is
what the pair achieves.
The minimal vamue is set to 10%, let's set the max to 1000%. This
avoids crashes when characters are too large.
The code is refactored to be more compact and the tests are more precise.
Fixes bug #12452.
Display manually set itemize symbols and their size in the work area.
Fix for bug #2277.
Also fixes a problem with document settings changed() not correctly emitted.
Inside a math inset when completing macro names, it could lead to crashes.
Note that this processUpdateFlags is present when outside of this if() branch.
The string that Qt sees is not the original string, since we add
zero-width nonbreaking spaces around it, plus an override character to
force rendering direction. This means that translating positions
between these two representation can be a bit tricky.
We use a max(foo, 0) here to make sure that our intermediate
computation is postive.
Fixes part of bug #12452.
When a string is broken at the margin by the Qt algorithm, the space
at which breaking occurred is automatically skipped in width
computation. However, the ending space of the string is taken into
account and is visible for example at paragraph end.
When the trailing space is followed by a displayed inset, then the
space should be skipped too, which means that the width of the last
row element has to be recomputed. For the sake of performance, the
width of the element without trailing spaces is computed in advance in
FontMetrics::breakString.
This "no space" width will be used when trimming a row element of its trailing
spaces instead of the original one.
Additionally, do not trim trailing spaces when the row is flushed.
Fixes bug #12449.
The search widget triggers a showEvent() in updateTitle() leading to setting the focus to the default push button.
The check in updateTitle() for the need to restore the title avoids superfluous show events and avoids the unwanted focus change.