Without this patch, when a file has to be loaded (for example,
after "Document->Settings->Local Class" or "Insert->Graphics")
and the file dialog is canceled, both Qt5 and Qt6 assert:
ASSERT failure in QList::at: "index out of range"
The old code only worked for toplevel cursors and did not show current cursor.
Note that the two windows do not have exactly the same offset.
Fixes bug #12689.
* The lyxpaperview script now only provides the paths and let us do the opening
* We use our own viewers for local files rather than QDesktopServices
Plus several minor improvements and code cleanup
Instead of just disabling MOUSE_MOTION on inset buttons, we now register
the coordinates where the latest mouse press happens, and if that's on
the inset button we are on when releasing, we toggle the inset.
Thus, minimal unintentional mouse movements don't lead to the button not
to respond.
- code reorganization to move the file name chooser methods in GuiDialog class
- on Mac add explicit raise of the current dialog window on close of the file browser to work around the bug 12576
The problem was that, in this case, we actually delete the current inset
in changeCmdName. So when we return from that and attempt to call initView(),
we're in a non-existent inset.
Another implementation would have been to use the lspace and rspace attributes in MathML, but they require to give the exact spacing before and after the operator instead of relying on rules like TeX.
For instance, `$a\mathbin{+}b$` resulted in this MathML output before the patch:
```
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mi>a</mi><!-- -->
<mi>[mathbin [char + mathalpha]]</mi>
<mi>b</mi>
</mrow>
</math>
```
For comparison, this was the output with LyX 2.3.7
```
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mrow><mi>a</mi><!-- -->
<mi>[mathbin [char + mathalpha]]
</mi><mi>b</mi>
</mrow>
</mrow></math>
```
After this patch, it looks like:
```
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mstyle class='math'>
<mrow>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
</mrow>
</mstyle>
</math>
```
This does now apply to the whole inset or paragraph group (not to the
current paragraph only) unless the new boolean AllowedOccurrencesPerItem
is set and we are in a list-type environment.
Amends 729ab602ca
This allows to restrict the use of flex insets to specific contexts.
Note that this is currently very basis. It only considers immediately
containing insets/layouts and can be surpassed via cut and paste.
The use case that made me finally implement this are macros in covington
that make sense only in specific environments (but also consider \inst
in some article classes)
A new counter type \superarabic is introduced, that transforms the
counter into superscript Unicode numbers.
This is used for the footnote counter.
The Foot inset layout is modified to use an empty LabelString (in size
Normal, since the numbers could be too small).
We use this occasion to set footnote text in footnotesize, as it should.
A couple of changes are done to the code to make the button label and
tooltip look better.
Fixes bug #12238.
* put the code that is called both from Buffer and InsetBrach in the
two helper methods Buffer::branchActivationStatus() and
Buffer::branchActivationDispatch().
* Cleanup the code so that _MASTER_ lfuns are disabled when there is
no master document.
* When changing branches in the master buffer, make the buffer visible
if it is not, and make sure that undo information is recorded.
* The code in Buffer::dispatch is used first, and it gives control to
the branch inset code if no branch name has been specified.
Fixes bug #12588.
* do not try to dissolve a macro template inset (avoids a crash)
* disable inset-dissolve when an argument is given
* when triggered by the AtPoint mechanism, make sur to dissolve the
right inset.
Fixes bug #12562.
Each removed inheritFont method is replaced by a 'InheritFont false'
line in the relevant InsetLayout entry.
Add code to layout2layout that does this automatically when the entry
is missing.
The case of InsetScript is special, since the inheritFont() was not
needed here: the default is indeed true.
Fixes bug #12238.
The font inside the inset is inherited from the parent for LaTeX
export if this parameter is true, as well as on screen. Otherwise
the document default font is used.
The default value is true.
Update tufte layouts to use this tag for sidenote and marginnote flex
insets.
Increase layout format to 101.
Fixes bug #12238.
Change KeyMap::getBinding to return FuncRequest::prefix in this case.
Add handling of this case in PrefShortcuts::validateNewShortcut.
What does not seem to work is that if, for example, accent-acute is
bound to M-s (which is a prefix for size-related bindings), and then
the binding is removed, the functions are not visibly restored.
Part of bug #10131.
While fixing #12491 at 0fed10e4, some band-aids were removed at the
end of `BufferView::scrollToBuffer`. One of them ensured that
scrolling to last paragraph would not leave the last row alone on
screen.
This behavior is actually correct when the scroll_below_document pref is true.
This commit restores the test that avoids the issue.
Of course, this does not fix the real issue, since for example opening
Tutorial.lyx and jumping to "5.3 Errors!" produces the same unwanted
effect.
The unicode representation in an ascii-string string is
\302\240 Normal space
\342\200\257 Non-breaking Thin (1/6 em)
\342\200\213\342\200\205\342\200\213 Medium(2/9 em)
\342\200\213\342\200\204\342\200\213 Thick (5/18 em)
\342\201\240\342\200\202\342\201\240 Half Quad(0.5 em)
\342\200\203 Quad(1 em)
\342\200\203\342\200\203 Double Quad(2 em)
\342\220\243 Visible space
'Double Quad' counts as 2 spaces, all others count as 1 space in the search regex
Remove some logic that would reset depth when editing non-environment
stuff (e.g. Standard layout) at non-zero depth. The current way of
decreasing depth is to use paragraph-break in an empty paragraph.
See discussion in ticket #2445 for why this code happened.
Fixes bug #12750.
The help page of int QMessageBox::exec() (https://doc.qt.io/qt-6/qmessagebox.html#exec) says:
When using a QMessageBox with standard buttons, this function returns a StandardButton value indicating the standard button that was clicked.
When using QMessageBox with custom buttons, this function returns an opaque value; use clickedButton() to determine which button was clicked.
This value is computed for the metrics of *every* Mathdata and hotspot
says that it counts for 9% of total on math-heavy "branch-test.lyx"
file. I am not sure that real world agrees with that, but profiling
shows that Qt itself does not cache the value.
Part of reinvestigation of #12297.
Profiling with hotspot show that it counts for more than it should and
indeed using support::contains is a overkill here. I like the new code
better anyway.
I would be surprised to see that it makes a big difference, though.
This is a kind of hack. This allows InsetMathHull to state that it
needs some elbow room beyond its width, in order to fit the numbering
and/or the left margin (with left alignment), which are outside of the
inset itself.
To this end, InsetMathHull::metrics() sets a value in
MetricsInfo::extrawidth and this value is recorded later in the
corresponding row element's `extra' field.
The code could be reorganized to be simpler, in particular by
computing metrics in tokenizeRow, or after tokenizeRow. However the
choice here is to produce a simple patch, fit for 2.4.0.
Fixes bug #12320.
When this parameter is given, only the current paragraph is affected
by the section promoting/demoting.
Note that the new argument is not used yet.
Update release notes and LFUNS documentation.
Part of ticket #12417.
If the cursor is in an inset, and it is closed (e.g., with ctrl + i,
or inset-toggle), the cursor is moved outside of the inset, so the
font must be reset.
The InsetMathChar::write() method directly accesses the otexrowstream
underlying the TeXMathStream class for writing a character, thus
shortcircuiting the mechanism that allows to separate a macro from the
following material. It has to do so because directly writing a char_type
would cause printing its numerical value instead of the corresponding
unicode character in systems where char_type is typedef'd to uint32_t.
This problem has been uncovered by [7441172d/lyxgit] because each atom
of a mathed cell was being separately written to the output instead of
using the lyx::write() method in MathExtern.cpp that simply converts
everything to a docstring. As InsetMathChar::write() is the only method
bypassing the TeXMathStream machanism, it is simpler teaching it to
honor the pending space instead of modifying the code in InsetMathColor.
This commit amends 7441172d.
The function outline is modified to operate only in the inset that
contains the cursor. This means that the function can be enabled in
insets (this had been forbidden to fix#5004).
Of course, there may be cases where the user expects something to
happen outside of the inset. I am sorry to announce that this is not
going to happen ;)
Fixes bug #12809.
This patch reuses the code of TextMetrics::displayFont() that handles
the label part of LABEL_MANUAL paragraphs to create a new
labelDisplayFont() method usable for things like Itemize labels.
To this end, and new magic value is used as position to force the
label case in displayFont(). The code is also factored a bit and
cleaned up.
Fixes bug #12810.
Otherwise we get the following warning:
src/frontends/qt/InsertTableWidget.h:44:7: error: 'hideEvent' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
void hideEvent(QHideEvent * event);
^
Amends ca5a75b2.
Jürgen cleaned up the previous contents of this "BUGS" file. What
was left (before the rm in this commit) had been written in 2001 at
2dd1a460, and it is not clear if it is still relevant.
This commit is very wrong when trivstrings are used (since what is
retirned is a temporary variable) and it turns out that cygwin
requires this for some reason.
This reverts commit 3ae5d6bdec.
For some reason, the code that should have been put in
updateCaretGeometry() went to resetCaret(). I do not see how that made
sense.
I am not totally sure what the consequences of the patch are, though.
It just "looks right".
This pane is responsible for horizontal excess size (at least in CZ
translation) of document settings panel. The reason is second encoding combo
which get very lengthy (there are actually 3 of them).
This patch moves them to separate line.
Beware, touching this panel is headache.
Qt Designer (5.15.2) does not know even how to load this ui
file correctly and it's impossible to move unicodeEncodingCO.
When breaking layout this CO is mysteriously deleted.
Finally I gave up and simply edited file in vim to get COs to the new row.
It turns out that LyX was using red as default color for the
inset button text since ever. However, due to the use of "inherit",
the default button text color was black in practice. This was so
until [897ee2ed/lyxgit], which made the label font not inherited
by default anymore. Hence, all insets that didn't specify a specific
label button color started using red as default color.
This commit restores the previous behavior and introduces the
possibility of modifying this default color.
Fixes bug #12771
This fixes the g++ 12 warnings below.
../../master/src/Converter.cpp:714:55: warning: possibly dangling reference to a temporary [-Wdangling-reference]
714 | Mover const & mover = getMover(conv.to());
| ^~~~~
../../master/src/Converter.cpp:714:71: note: the temporary was destroyed at the end of the full expression ‘lyx::getMover(lyx::Converter::to() const())’
714 | Mover const & mover = getMover(conv.to());
| ~~~~~~~~^~~~~~~~~~~
../../master/src/Converter.cpp:786:39: warning: possibly dangling reference to a temporary [-Wdangling-reference]
786 | Mover const & mover = getMover(conv.from());
| ^~~~~
../../master/src/Converter.cpp:786:55: note: the temporary was destroyed at the end of the full expression ‘lyx::getMover(lyx::Converter::from() const())’
786 | Mover const & mover = getMover(conv.from());
This is done at the end of the release cycle to avoid backporting issues.
The goal is to simplify development, since it was difficult to guess
in which file a given method could be found.
There is some effect on compilation time, but it is not too bad:
* before merge
lapinot: time make Text.o Text3.o Text2.o
CXX Text.o
CXX Text3.o
CXX Text2.o
real 0m32,504s
user 0m31,027s
sys 0m1,446s
lapinot: rm Text*.o
lapinot: time make -j8 Text.o Text3.o Text2.o
CXX Text.o
CXX Text3.o
CXX Text2.o
real 0m21,282s
user 0m32,661s
sys 0m1,424s
* after merge
lapinot: time make Text.o
CXX Text.o
real 0m26,731s
user 0m25,706s
sys 0m1,020s
Due to a macOS peculiarity, it is necessary to handle KeypadModifier.
We do it unconditionnally, although only macOS seems to be affected.
"Note: On macOS, [...] The KeypadModifier value will also be set when
an arrow key is pressed as the arrow keys are considered part of the
keypad." (https://doc.qt.io/qt-6/qt.html#KeyboardModifier-enum)
Related to bug #12572.
This is a follow-up to 5be391b2, which increased the space on
left/right of graphics inset. This extra space makes sense in normal
graphics editing, but is weird in the case of InsetInfo, which has its
own spacing.
Create a special tight graphics inset class, and use that for icons.
Qt 6.5.0 has dropped support for the QWindowsMime class
in favor of a new QWindowsMimeConverter class. They say:
"If you have implementations of QWindowsMime or QMacMime in Qt 5,
then those will almost directly translate to the new APIs but
require less boiler-plate code to register the converters with Qt."
This may be true, but in practice they break binary compatibility with
previous versions. If you used the QWindowsMime class until Qt 6.4 by
using boiler-plate code to register the converters with Qt, you now
need to modify the sources and recompile. Fantastic!
Declare override, otherwise we get the following warning:
src/insets/InsetListings.h:42:7: error: 'isEnvironment' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool isEnvironment() const { return !params().isInline(); }
^
src/insets/Inset.h:606:15: note: overridden virtual function is here
virtual bool isEnvironment() const { return getLayout().latextype() == InsetLaTeXType::ENVIRONMENT; }
^
1 error generated.
This fixes on-screen appearance of things like code with lines longer
than the window width.
The TeXbook makes it clear by indicating that \fontdimen3 == 0 for
these fonts.
The test that was used to avoid breaking a string that was followed
by a too long element was not correct (especially the part that
compared with total row width).
Typical example here is:
- a word with a part that has a font change like /un/breakable;
- a longish sentence after it.
Use a new test that is good enough for this particular case, although
with sortcomings. I do not want to overcomplicate and prefer to wait
for other complaints (this code is already more complicated that I
would like).
Document known shortcoming.
Fix ticket #12660.
Instead of actually fixing the messiness of InsetInfo, let's just fix
the symptom and avoid the access to Paragraph::id() that was crashing
LyX every time updateBuffer/validate/metrics/draw did not happen in
the right order.
Fixes bug #12639.
After removing/adding rows, the corresponding equation numbers in
the LyX display were not updated (although if you clicked outside
the math inset they were).
Now they are updated immediately after the operation.
Parts, chapters and sections have different LabelTypes, but this does
not mean they cannot be transformed into each other while doing
OUTLINE_IN/OUT
Not sure why the labeltype check is here anyway, but let's keep it.
This is my 635th lesson that trying to be too clever is not that good.
This change interferes with the yet-to-come fix to #12674.
This reverts commit cc6dae1363.
When computing the width of the button, some code has been added in
04ece4f0 to shorten the space in LeftButton geometry. It turns out
that the Left/Top-button-ness is not always known at this point (since
it depends on the width itself!).
Therefore, it is better to make the button narrower also in the
TopButton case.
See the thread
2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))
on lyx-devel (26/01/2023).
The backtrace imply a problem like:
1/ metrics are computed for some info inset
2/ the info inset is regenerated (and thus the paragraph it held is now invalid)
3/ We draw the inset and because of the new (disabled by default)
bookmark display code, we access the id() of the invalid paragraph.
4/ boom!
To fix the issue, introduce a new boolean member that indicates when
the Row object of the metrics should not be used. In this case, the
draw() method returns early.
Typically there are two sources of spacing:
* the button has two pixels added to the left and to the right
* the frame around the text also has 2 pixels to the left and to the right
Note that this value of two pixels is given here for simplicity, but
these are parameterized by methods like textOffset or leftOffset.
What we want to remove is the space after the button and the space
before the frame. This is done in 3 places
In dimensionCollapsed(), the extra space is removed from the dimension
after its computation
In metrics(), the space avoided before the frame is removed from width.
In draw, the whome text inset is drawn with a negative offset.
Fixes#12335.
This commit had had an additional not documented change: redraws
happen only when they are needed. This did not help fix the bug, but
looked smart on first sight. Alas, I find that these smart changes
added because "why not?" tend to come back to haunt me eventually.
In particular this case, the problem was that the code tested whether
the offset of anchor paragraph had changed, but not whether the
paragraph itself had changed. This means that, when switching from one
section to another with the outliner, the view was not updated.