Commit Graph

29247 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
0867aaf5c5 Fixup f4364c75: remove two more Update::SinglePar instances
They do not do what the author(s) of these lines thought it would do,
and can create crashes.

(cherry picked from commit 485f5afc21)
2024-07-20 23:50:48 +02:00
Pavel Sanda
33b1d7e39f Status bar did not show font info anymore.
This line from commit 1d1f95d2e seem to inadvertedly
slipped into commit 76dbb9dc.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg222405.html
2024-07-19 23:51:20 +02:00
Jean-Marc Lasgouttes
e57ccede18 Fix faulty undo recording
The recordUndo() call is very wrong, since we may be inserting over a
selection covering several paragraphs (undo itself works at paragraph
granularity).

recordUndoSelection() is the right operation in this case. It is
equivalent to recordUndo() when there is no selection.

(cherry picked from commit 82f387dabc)
2024-07-18 23:40:39 +02:00
Juergen Spitzmueller
f8949079ef Fix crash when attempting to search in selection that contains only math
(cherry picked from commit cca68d0614)
2024-07-15 18:22:13 +02:00
Juergen Spitzmueller
d15f4fe5ec GuiTabular: add missing connections
(cherry picked from commit 2bf3124f25)
2024-07-14 19:09:21 +02:00
Jean-Marc Lasgouttes
aadf3d8a5d Make BufferView::singeParUpdate more robust
In some cases, it might happen that this method is called with no
metrics or position known for the current paragraph.

Take care of these cases to avoid assertions.

Remove setting of inset positions in the method, but make sure that
updateMetrics(false) is always called to get everything right.

In the new code, updateMetrics(bool) is the method that sets
everything right with minimal effort.

(cherry picked from commit 89ab9eb569)
2024-07-10 17:18:48 +02:00
Jean-Marc Lasgouttes
f4364c7593 Remove useless SinglePar update when scrolling in text
Using SinglePar does not majke sense here since the paragraph is not
modified and it might even not have a position yet.

This fixes a crash in BufferView::singleParUpdate, which is not
prepared (yet) to such situations.

(cherry picked from commit 2bdd691130)
2024-07-10 17:18:48 +02:00
Jean-Marc Lasgouttes
2886843560 Make sure paragraph positions are updated when scrolling
Sometimes quick selection-scrolling could cause a crash because the
position of some paragraphs is not computed. To fix that, in
BufferView::showCursor, make sure that the metrics are always kept
clean using updateMetrics(false), which is lighweight.

As a consequence, the 'update' parameter of showCursor and
scrollDocView is not needed anymore. Its removal is mechanical and
accounts for most of this commit.

The only other significant change is that, when creating synthetic
mouse events and relying on scroll() for small moves, the full metrics
recomputation is replaced by the lighter version.

More work is still to come on this code, but this should be going in
the right direction.

(cherry picked from commit 6e0ea4269a)
2024-07-10 17:18:47 +02:00
Jean-Marc Lasgouttes
10b8861d10 Handle metrics of not visible paragraphs
The code is not ready for situations where some paragraphs that are
not visible have metrics available.

In PararagraphMetrics, some methods are added to be able to handle the
fact that paragraphs have or do not have a position.

In TextMetrics, a new method returns the first visible paragraph.

Finally, in BufferView::updateMetrics, the paragraphs' positions are
reset (in the case where everything is not cleared) and some care is
taken to skip the ones that are not relevant.

The assumption outside of this method is that all the paragraphs that
are in the TextMetrics are visible (we are talking about top-level
TextMetrics here). This could be changed (in order to avoid
recomputing paragraph metrics), but the cost is high in terms of
complexity and it is not clear that the gain in terms of performance
would be important.

NOTE: contrary to the code in master which returns npos = -10000, this
code still returns -1 when the position of a paragraph is unknown.

(cherry picked from commit 145af7c2ac)
(cherry picked from commit 05bb851adf)
(cherry picked from commit 8bc3799b35)
2024-07-10 17:18:47 +02:00
Jean-Marc Lasgouttes
f64349db8d Fix display of page references when language is not specified
Using translateIfPossible with null language does not make sense (and
gives an error on console).

Using translateIfPossible there actually does not make sense at all: it
is only for string from layout files that may already be translated.

We use the GUI language when no language has been specified (this is
different and probably safer than what is done in master).

A consequence of the commit is that "elsewhere" will be in the po
files and now really translatable ;)

(cherry picked from commit 6f6d9b631d)
2024-07-10 15:23:46 +02:00
Juergen Spitzmueller
fcd61f90e7 Cut excessively long author lists before parsing them for the GUI
as they will be truncated anyway.

Fixes performance issues with long author lists in bib files.

(cherry picked from commit 7d2d26132b)
2024-07-05 18:54:27 +02:00
Juergen Spitzmueller
0f35e3141b Remove performance bottleneck in getAuthors()
The regex is expensive which is especially noticeable with very long
author lists.

This introduces a case-insensitive subst() variant which is much faster.

(cherry picked from commit 8ba74fe958)
2024-07-05 18:54:03 +02:00
Richard Kimberly Heck
46d1d6e0d3 Remove setBuffer call in Cursor::push.
This is potentially slow. It also should be unnecessary after
some of JMarc's recent commits. See bug #13050.

(cherry picked from commit 66cfc6af3c)
2024-07-05 12:28:40 +02:00
Jean-Marc Lasgouttes
b39fb17316 Force a Buffer * argument to math insets constructor
Make sure that math insets have a proper buffer. To this end, make the
Buffer* parameter of InsetMath mandatory and fix the compilation
errors that ensue.

(cherry picked from commit c013799887)
2024-07-05 12:23:59 +02:00
Jean-Marc Lasgouttes
6b54661317 Force a Buffer * argument to MathData constructor
In order to ensure that MathData objects have a valid buffer, the
default MathData() constructor is deleted. This means that a buffer
shall be specified for each MathData object created.

This is fairly mechanical, actually. In particular, in most
InsetMathXxx cases, in MathData and in MathParser, the available
buffer_ member is used.

More specific cases:
- lyxfind.cpp takes the buffer from the Cursor

- calls to vector<MathData>::resize take an additional
  MathData(buffer_) parameter. There are cases where resize actually
  remove cells, and in this case clear() or even erase() have been
  used.

- in InsetMathMacroTemplate, the optional parameters of the
  constructors cannot be allowed anymore (a default value cannot
  depend on another parameter). Therefore there a now two constructors
  instead.

- in MathAutoCorrect.cpp, the MathData objects are not bound to a
  buffer, so that std::nullptr is used instead.

- in MathExtern, use a buffer when one is specified, std::nulptr
  instead.

(cherry picked from commit 57d7130655)
2024-07-05 12:21:47 +02:00
Juergen Spitzmueller
03f59bf49e Remove unneeded cycle checks (#12954)
(cherry picked from commit b5260a3a0f)
2024-07-03 09:50:52 +02:00
Juergen Spitzmueller
e5030ad915 Amend fd78a25a7c
This way, it is a bit more plausible what we're doing

(cherry picked from commit c394a1ccf9)
2024-07-03 09:50:34 +02:00
Juergen Spitzmueller
f9dccb9afb Only issue currentWorkareaChanged() if the work area really changed.
(this function can be called repeatedly while the work area doesn't
change any further)

(cherry picked from commit fd78a25a7c)
2024-07-03 09:50:10 +02:00
Juergen Spitzmueller
2cc5ca27fd Fixup [152811a27d242/lyxgit]
tabBarClicked() should really only reset focus if a click in a different
TabBarGroup happened. And no need to issue workAreaChanged() again.

This has lead to extra and erroneous focus changes (see #12954)

(cherry picked from commit 026c4bd726)
2024-07-03 09:49:54 +02:00
Pavel Sanda
6aef9e394e cosmetics - synchronize with the rest of strings 2024-07-02 23:50:25 +02:00
Jean-Marc Lasgouttes
1d25832edc Avoid crash when InsetBibitem::updateCommand shows a dialog
This is one of the places where a dialog is shown (indicating that
some bibtems have been renamed) while the metrics are not up to date.
Then a draw operation can be triggered too early and a crash can ensue.

Use ad-hoc solution for this case and use Buffer::setBusy(). The
Alert::warning helper cannot really do that since it doe snot know the
current buffer.

(cherry picked from commit c84c59eaec)
2024-07-02 15:15:34 -04:00
Juergen Spitzmueller
b295b39de1 Do not check for diverging input encoding if the files use XeTeX/LuaTeX
Fixes the problem reported at
https://marc.info/?l=lyx-users&m=171986173131406

(cherry picked from commit 4ed8bfb974)
2024-07-02 15:14:28 -04:00
Juergen Spitzmueller
a1141c32eb GuiDocument::onBufferViewChanged(): exit early if dialog is not open
This should fix the bug reported at
https://marc.info/?l=lyx-users&m=171957953801548&w=2

(cherry picked from commit 574db22025)
2024-07-02 15:13:47 -04:00
Richard Kimberly Heck
7d9a8b00f9 Revert "Add temporary directory to About LyX dialog"
This introduced a new string, which is not for 2.4.1.

This reverts commit 5b51bab39b.
2024-06-25 13:38:58 -04:00
Richard Kimberly Heck
5b51bab39b Add temporary directory to About LyX dialog
(cherry picked from commit e7af6afb01)
2024-06-25 11:33:28 -04:00
Pavel Sanda
9ebf3ed0ea Let the middle button pasting respect newlines by default.
This makes it in sync with the new default for Edit > Paste operation.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg222233.html
2024-06-24 22:39:20 +02:00
Juergen Spitzmueller
59648b5d35 \cprotect amendment
\cprotect'ed insets do not need forced local font switch; in fact files
with this break in compilation. E.g. a caption with an URL containing
the char '#' and caption text set to a secondary language.

(cherry picked from commit 8659924abd)
2024-06-22 20:03:56 +02:00
Juergen Spitzmueller
ce88e46a3d GuiDocument: do not ask switch-back question on document closing
(cherry picked from commit c243126eb4)
2024-06-16 10:58:06 -04:00
Juergen Spitzmueller
6b3782e07b Prevent division by zero
Fixes crash reported at
https://marc.info/?l=lyx-users&m=171842978728676

(cherry picked from commit 0fc8ee5ace)
2024-06-15 12:05:48 -04:00
Richard Kimberly Heck
d54ed5569d Update doc info for quote-insert 2024-06-15 10:30:43 +02:00
Alexander Dunlap
415932359a FindAdv: Omitting cursor advance at start of search if in mathed.
Fixes #13070 Advanced S&R does not find math symbols at start of document

(Should be cherry-pick of 8c501308, but due to merge conflicts its done
manually)
2024-06-10 20:08:39 +02:00
Udi Fogiel
f04ffb2513 Fix change tracking colors with RTL languages (#12923)
(cherry picked from commit a5749b9c1f)
2024-06-10 15:20:16 +03:00
Udi Fogiel
ecbe5d263d Fix greyedout with RTL languages (#8647)
(cherry picked from commit ee43584140)
2024-06-10 15:09:00 +03:00
Daniel Ramoeller
259c89f45e Extend tab context menu features
Add

- Close Other Tabs
- Close Tabs to Left/Right
- Move Tab to Start/End
- Show Enclosing Folder

to the tabs context menus.

Fix for bug #11963

(cherry picked from commit a114f12868)
2024-06-09 13:50:10 -04:00
Richard Kimberly Heck
3c909daeea Merge branch '2.4.x' into 2.4.1-devel 2024-06-09 13:13:12 -04:00
Enrico Forestieri
4acc6e36e3 Fix textstyle-update handling in mathed
The code was expecting that all properties were specified
in the argument and not only some. Simply do not process
those properties not specified in the argument.

(cherry picked from commit afb70c905b)
2024-06-09 13:10:15 -04:00
Juergen Spitzmueller
5a69b8a184 Return false on invalid input in Font::fromString()
Fixes crash with invalid font-update lfun

(cherry picked from commit 2a9648fc4c)
2024-06-09 13:10:05 -04:00
Richard Kimberly Heck
4bd03197d1 Fix table crash reported on Windows.
(cherry picked from commit 3e796c680a)
2024-06-07 15:59:38 -04:00
Juergen Spitzmueller
d4bd0f9b1e Strip quotes from PackageOptions. Amends a77c84a0b4
(cherry picked from commit 1449fbf9ae)
2024-06-06 19:00:34 +02:00
Jean-Marc Lasgouttes
312dacb7f3 Fixup 39c7199a: the code did not do what it was supposed to
(cherry picked from commit 92ef555abd)
2024-06-06 18:22:26 +02:00
Jean-Marc Lasgouttes
13a6be1f9c Do not draw appendix lines below en of document
This bug is pretty old, but it was not visible because the grey area
below the document would overwrite it.

It would be better to close the frame at the end of the document, but
this is for later.

(cherry picked from commit 7acfbe0fcc)
(cherry picked from commit c96d3a0340)
2024-06-06 18:18:02 +02:00
Udi-Fogiel
41f080c5ef avoid adding redundant preamble to double column hebrew documents (#12919) 2024-06-03 21:05:20 +03:00
Juergen Spitzmueller
c0df9e193c Show full inset context-menu when clicking on text part of collapsible (#10370)
Re-fix this since #12907 has been resolved

(cherry picked from commit 7a85b1b7ca)
2024-06-03 17:58:09 +02:00
Richard Kimberly Heck
90ab21e0e9 Fix table crash reported on Windows.
(cherry picked from commit 3e796c680a)
2024-06-03 11:39:42 -04:00
Kornel Benko
5fdbd2cf32 Adv. F&R: strange dialog text
Fixes #12997
Added 'Scope' to better indicate the searched area.
2024-06-03 08:23:35 +02:00
Richard Kimberly Heck
63b23ce288 Fix bug #13066
Patch from Lorenzo

(cherry picked from commit 0c70f340c0)
2024-06-02 23:08:05 -04:00
Richard Kimberly Heck
701c763221 Merge branch '2.4.x' into 2.4.1-devel 2024-06-02 21:49:54 -04:00
Richard Kimberly Heck
1d7c8325f2 Put new citation after selected item rather than at end of list.
Fixes bug #12940.

Patch from Daniel.

(cherry picked from commit 40ae8644f9)
2024-06-02 20:54:46 -04:00
Thibaut Cuvelier
37a865762b XHTML: export paragraph IDs also for list items, but not for the opening tag of the list.
The IDs are used to link to specific elements (for instance, the User's guide nomenclature).

The beginning of the list (<ul> or <ol>) has the same magic ID as the first item of the list.
2024-06-02 11:59:41 +02:00
Thibaut Cuvelier
c5b1ce5f37 Make comment clearer. 2024-06-02 11:59:18 +02:00