Commit Graph

678 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
91c5061d26 Revert "Reset inline completion after undo/redo"
Try a solution closer to other code instead.

This reverts commit e59aee4580.
2021-10-14 16:26:21 +02:00
Jean-Marc Lasgouttes
e59aee4580 Reset inline completion after undo/redo
Fixes bug #12383.
2021-10-12 15:45:04 +02:00
Jean-Marc Lasgouttes
e09158efee Use unordered maps to store inset and math rows geometry.
Simply using unordered_map instead of map makes a big difference for
documents with lots of math insets in one text inset.

Related to bug #12297.
2021-10-08 18:17:19 +02:00
Jean-Marc Lasgouttes
42abb26054 Make paragraph-goto and friends set paragraph to the top
Add parameter 'force' to scrollToCursor(...) to avoid the case where the
cursor is not set to top because it is already visible on screen.
Change screen offset in this method so that the paragraph is really at
the top of the screen. This part may cause unforeseen issues and needs care.

gotoInset: use the new force flag and do not trigger a redraw.
Instead, return a boolean telling whether redraw is needed.
In the code that use it, set an update flag instead of the extra redraw.

In the handling of paragraph-goto, also set the update flag instead of
triggering a repaint.

Remove Bufferview::scrollToCursor(), which was equivalent to showCursor().

Fixes bug #10425.
2021-09-29 12:16:39 +02:00
Jean-Marc Lasgouttes
0f0ad1f715 Make bookmarks display configurable
Introduce a GUI-less LyXRC member bookmarks_visibility. This is
experimental and will not be documented for 2.4.0. Having the code
present will allow to (1) improve it gradually and (2) fix the many
bookmarks bugs that it exposes.

The corresponding tag is \experimental:bookmarks_visibility, which is
intentionally weird.

Three possible values:

* none: no bookmark display
* margin: display the bookmark in margin
* inline: display the bookmark at cursor position.

The default margin has been made wider so that there is room for the
bookmark. This was necessary anyway. The margin bookmark is now
displayed correctly in full screen with limited text width.

Margin display still needs some improvements when several bookmarks
are on the same row.

Mostly fixes bug #2496.
2021-04-07 16:19:20 +02:00
Enrico Forestieri
eeb36e808c Change cursor shape for clickable math insets
Currently, only InsetMathRef and InsetMathSpace are clickable.
2021-04-01 16:59:55 +02:00
Jean-Marc Lasgouttes
0429b580e6 Fixup 4671214f: add comment 2021-03-26 14:26:15 +01:00
Daniel Ramoeller
4671214f3d Keep caret visible when small
Fix for ticket #12190.
2021-03-26 12:43:11 +01:00
Juergen Spitzmueller
ae892bff98 Fix copy of multi-cells in table (#12196) 2021-03-12 17:44:33 +01:00
Jean-Marc Lasgouttes
447a1056b4 Fix bookmarks-goto inside insets.
A stupid oversight, as far as I can see.
2021-03-11 16:16:11 +01:00
Jean-Marc Lasgouttes
b87a81c394 Fixup fbf22bb3: really avoid screen-jumping with mouse click.
It turns out that the commit from gadmm's lyx-unstable has been
cherry-picked at the wrong place! However I believe that both changes
are necessary.

With this second patch, I do see that some screen jumping is avoided.

Fixes bug #7457.
2021-03-10 10:43:45 +01:00
Jean-Marc Lasgouttes
776807a536 Constification 2021-03-10 10:43:45 +01:00
Jean-Marc Lasgouttes
9a2b8c87cd Code reformatting. 2021-03-10 10:43:45 +01:00
Enrico Forestieri
7545698380 Fix bug #12181
The context menu for InsetMathRef is now usable.
InsetMathRef still misses support for RefStyle and thus the
corresponding entries are omitted from the menu. But this would
be a different bug.
2021-03-06 23:36:58 +01:00
Enrico Forestieri
5a43b86141 Allow context menus in mathed
It is now possible to get a context menu for math insets.
InsetMathSpace was already providing a specific context menu,
but it was never triggered because the math hull inset is not
descendable. It is still so, but now when a context menu is
requested all the insets inside the math hull are examined.
If the inset under the cursor provides a context menu, it
is shown instead of the general math one.

Fixes #12100.
2021-03-05 21:21:41 +01:00
Jean-Marc Lasgouttes
fbf22bb3f3 Fix random scrolling inside nested insets
Happened when the BufferView was resized (e.g. math toolbars were
displayed/hidden).

Backported from gadmm's lyx-unstable tree
https://gitlab.com/gadmm/lyx-unstable/-/commit/a868bc034cea4c

Possible fix to bug #7457.
2021-03-02 18:10:12 +01:00
Jean-Marc Lasgouttes
42b23f3fb2 Display bookmarks in the workarea (take 2).
The bookmarks are shown with circled numbers in the right margin (or
the left margin in RTL mode). A new color "bookmarks" has been added.
Currently bookmark 0 (the return position) is not displayed because it
is very disturbing in practice.

To make this work, a new method BookmarksSection::bookmarksInPar
retuns the list of bookmarks in a paragraph along with their position.

Force redraw when using bookmark-save and bookmark-clear.

Caveats:

- this solution does not show the precise position of the bookmark
  (this is supposedly not a problem).

- if several bookmarks are on the same row, they will currently be
  garbled. It would be easy to make sure that only one is shown ; what
  would be more difficult would be to move the second bookmark lower.

- it is possible to make sure that the markers are correctly centered
  in the margin, and that the margin size is large enough to hold the
  marker (I did not try all fonts).

Fixes bug #2496.
2021-02-26 19:09:25 +01:00
Jean-Marc Lasgouttes
e4ab91d802 Revert "Display bookmarks in the workarea."
This will be replaced by a different version.

This reverts commit 99e636ae7b.
2021-02-26 18:07:39 +01:00
Jean-Marc Lasgouttes
090e9a6c36 Keep the useful parts of reverted commits
Keep from 907f0207 the introduction of BufferView::top/bottomMargin()
and the setting of the top/bottom margin of the document. The
difference is that the extra height is still added to the relevant
rows, and not only to the paragraph metrics.

Keep from f41ca959 the reduction of top/bottom margin for Adv F&R
workareas.
2021-02-16 12:29:40 +01:00
Jean-Marc Lasgouttes
a40ca1430e Revert "Improve handling of top and bottom margin"
This reverts commit 907f020724.
2021-02-16 12:29:40 +01:00
Jean-Marc Lasgouttes
810b86560a Revert "Reduce top/bottom margin for Adv F&R workareas"
This reverts commit f41ca959fd.
2021-02-16 12:29:40 +01:00
Jean-Marc Lasgouttes
f6c87c63c1 Revert "Make sure that top/bottom margins are visible when needed"
This reverts commit a78eb4471f.
2021-02-16 12:29:40 +01:00
Juergen Spitzmueller
5980afaee0 Add support for search/replace within selection (#2548) 2021-02-16 08:11:09 +01:00
Juergen Spitzmueller
958213ee52 Improve instant search 2021-02-15 14:12:07 +01:00
Juergen Spitzmueller
f59b8cb657 GuiSearch: Add auto-wrap option 2021-02-15 11:30:03 +01:00
Stephan Witt
a476cc4839 #8055 add support for system-wide find buffer on Mac
Command-E is standard for paste to find buffer on Mac. That's why the key binding is changed appropriately.
2021-02-14 18:56:25 +01:00
Stephan Witt
46bb8f22c9 #8055 correct processing of LFUN_WORD_FIND option flags for repeated search operations 2021-02-13 04:47:44 +01:00
Jean-Marc Lasgouttes
1cbbe5c3aa Do not redraw cursor twice with Page Up/Down
Just recompute metrics instead of triggering a full redraw. The old
behavior was that, when the document was less that one page long, the
cursor would blink to the top of the document before going to its
correct position.
2021-02-12 18:35:07 +01:00
Jean-Marc Lasgouttes
a78eb4471f Make sure that top/bottom margins are visible when needed
When the cursor is at the top, it is important to make sure that, not
only its row is visible, but also the extra margin at the beginning of
the document, that was added at 907f0207.

Fixes part of bug #12123.
2021-02-12 18:35:07 +01:00
Juergen Spitzmueller
b75fc70561 Adapt comment 2021-02-12 14:43:56 +01:00
Juergen Spitzmueller
7f90e3b7d2 Introduce search-string-set (#8055)
This stores its argument, the currently selected text or the word under
cursor in the search cache that is used by word-find[-backward|-forward]
if no argument is given to those.

Prerequisite for a feature apparently expected on the Mac.
2021-02-12 14:30:50 +01:00
Juergen Spitzmueller
e35574b3ce Store the AuthorList in the cut stack
Otherwise we crash when we paste text with markup into a different buffer
that has change tracking disabled (in this case, markup is now kept).
2021-02-09 16:54:21 +01:00
Jean-Marc Lasgouttes
f3a0e8ff9a Run updateBuffer when adding/merging changes
Following 4a4ded22, the enabling of some change-related functions is
handled in updateBuffer. However, this method is not ran at every
document change for performance reasons.

This patch adds code to every place that modifies
Paragraph::Private::changes_ that checks whether the `changedness' of
the paragraph, err... changes.

To this end, a new helper struct is introduced that remembers
paragraph state at contruction time, and compares it to new state in
the destructor.

New forceUpdate/needUpdate methods are added to Buffer class, since
the cursor is in general not available in the places where these
changes are made.

Fixes bug #12074.
2021-01-28 11:30:05 +01:00
Richard Kimberly Heck
1582a2afe1 Fix bug #12068 2021-01-14 01:15:19 -05:00
Juergen Spitzmueller
1b2a56e2d2 Ignore tracked deletions in simple replace (#11194) 2021-01-12 16:13:47 +01:00
Jean-Marc Lasgouttes
9e1db65932 Move handling of LFUN_COPY to BufferView
It turns out that the code is the same in texted ans mathed and that
whatever is done in InsetTabular is not useful.

This means that we do not need to deal Text::dispatch idiosyncrasies
(in particular forcing the cursor to be visible).

Fix bug #11225.
2021-01-08 19:31:42 +01:00
Jean-Marc Lasgouttes
99e636ae7b Display bookmarks in the workarea.
The bookmarks are added as virtual elements in display Rows. Bookmarks
are shown with circled numbers. A new color "bookmarks" has been
added. Currently bookmark 0 (the return position) is not displayed
because it is very disturbing in practice.

To make this work, a new method BookmarksSection::bookmarksInPar
retuns the list of bookmarks in a paragraph along with their position.

Force redraw when using bookmark-save and bookmark-clear.

Fixes bug #2496.
2021-01-06 20:20:03 +01:00
Richard Kimberly Heck
84e8ce4ce5 Simplify 2021-01-04 01:40:22 -05:00
Richard Kimberly Heck
db36ec1ccf Pop a message if the search fails. Fixes #11441 2021-01-04 01:06:33 -05:00
Yuriy Skalko
9cb98136ce Cleanup headers 2020-12-03 00:38:27 +02:00
Jean-Marc Lasgouttes
f41ca959fd Reduce top/bottom margin for Adv F&R workareas 2020-12-01 12:01:20 +01:00
Jean-Marc Lasgouttes
1b3ffa6627 Rewrite (again!) the code for caret drawing
The caret geometry is now computed in BufferView as a list of shapes
(caret, horizontal l-shape if needed, completion triangle if needed)
kept in a variable of type CaretGeometry.

The code in WorkArea.cpp only has to draw these shapes. The
CaretWidget (which never was a widget) in GuiWorkArea.cpp is gone
now.

As a consequence, the bounding box for the cursor is known precisely
and therefore rows should be repainted correctly now. This avoids
caret droppings.

Fixes bug #12024.
2020-11-24 20:12:42 +01:00
Jean-Marc Lasgouttes
7a28258d32 (almost) Proper fix for caret droppings
Try to find the most inner row that is overwritten by the caret. This
allows to replace the hack in TextMetrics::draw, which did not really
work.

Note that there are still issues with emphasized caret at the
beginning of inset, which will require some code reorganisation.

Fixes current recipe of bug #12024.
2020-11-21 20:00:26 +01:00
Jean-Marc Lasgouttes
ba8ca0e384 Correct caret position from the start 2020-11-21 19:39:48 +01:00
Yuriy Skalko
589e780e15 Whitespace & renaming 2020-11-06 21:34:02 +02:00
Yuriy Skalko
d38eddb397 Match header/source function argument naming 2020-11-01 22:23:44 +02:00
Yuriy Skalko
5061db891c Use const references 2020-11-01 22:23:26 +02:00
Yuriy Skalko
196d9caeb0 Clean includes using the output of iwyu tool 2020-10-20 11:38:55 +03:00
Yuriy Skalko
65c88f0a0a Remove redundant const & for primitive types 2020-10-19 12:50:07 +03:00
Jean-Marc Lasgouttes
c516c86d19 Make cursor width depend on current font
This makes the cursor more visible wrt current font.

Moreover make the cursor width scalable by default.
2020-10-13 17:27:52 +02:00