Commit Graph

324 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
786a6edb54 Disable completion when document is read-only.
Being able to insert completion in a read-only document is definitely
a bad idea.

This patch acts both on indication of completion and on insertion
itself.

Fixes bug #12582.
2022-10-08 12:52:05 +02:00
Jean-Marc Lasgouttes
8508c3fe04 Completion: handle undo in insets' insertCompletion methods
I mathed, undo should record the underlying inset on completion,
whereas in test recording the paragraph is enough.

Therefore the recordUndo() in GuiCompleter::tab is removed, and the
relevant recordUndo/recordUndoInset are used at the right places.

As a further cleanup, the parameter `finished' of
Text::insertCompletion is removed as it is useless.

Fixes bug #12581.
2022-10-05 09:48:01 +02:00
Daniel Ramoeller
2b493ff70f Word selection on mouse motion
Partial fix for bug #9160.
2022-05-17 18:45:31 +02:00
Jean-Marc Lasgouttes
5f4890721b Improve display of META_INSET in status bar. 2021-10-15 11:11:57 +02:00
Yuriy Skalko
6a7c9d12f9 Amend d3c335a5d5 2021-10-05 17:10:51 +03:00
Juergen Spitzmueller
e2f3dd5f6a Consider selection scope when DEPM after CT acceptance/rejection (#2166)
This fixes a crash and DEPM overshooting.
2021-03-02 09:15:33 +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
Juergen Spitzmueller
8d5da386c4 Amend [b6c089afa4/lyxgit]. 2021-02-03 10:23:17 +01:00
Richard Kimberly Heck
7b6db55f28 Use a static map so we don't have to reinitialize every time. 2021-02-02 17:30:57 -05:00
Richard Kimberly Heck
b6c089afa4 Fix #12104 2021-02-02 17:23:00 -05:00
Stephan Witt
e29896d93d Amend 18f7dce3d9 - avoid uninialized local variable atlastpos 2020-12-29 11:41:24 +01:00
Juergen Spitzmueller
4886c0370b inset-split: consider that freeSpacing() doesn't DEPM 2020-12-27 14:28:03 +01:00
Juergen Spitzmueller
18f7dce3d9 Implement inset-split (only for text insets for now) (#10260) 2020-12-24 10:48:52 +01:00
Jean-Marc Lasgouttes
69c46c56fe Preserve paragraph depth when dissolving.
It turns out that makeSameLayout() does more than we want.

Fixes bug #11981.
2020-12-10 18:34:07 +01:00
Yuriy Skalko
e292dd70bf More enums & includes refactoring 2020-12-06 18:26:41 +02:00
Yuriy Skalko
1b508fff03 Small refactorings 2020-10-25 09:28:41 +02:00
Yuriy Skalko
196d9caeb0 Clean includes using the output of iwyu tool 2020-10-20 11:38:55 +03:00
Yuriy Skalko
fe85162a29 Refactoring 2020-10-05 14:55:00 +02:00
Yuriy Skalko
efc0877f8f Add override specifiers to improve code maintainability 2020-10-03 12:43:48 +02:00
Jean-Marc Lasgouttes
f9aadae290 Get rid of helper Text::previousWord(), used only once 2020-09-29 10:15:31 +02:00
Yuriy Skalko
b0db575dc1 Show custom text styles in status bar
Fixes bug #11951.
2020-09-14 11:38:29 +02:00
Stephan Witt
320b6b6656 #6401 correct cursor movement for word forward/backward with enabled Mac style (mac_like_cursor_movement)
The change includes a rewrite of the cursor movement when „mac style“ is enabled and don’t change anything otherwise.
The new code for mac uses the document iterator to go forward or backward. The traversal stops at word boundaries.
If going forward the position increments until a word is reached (if not already inside) and stops at the end of the word.
If going backward it does the same in opposite direction. The cursor jumps over non-editable insets and math.
Editable (open) insets are entered and the cursor move detects word boundaries inside them.
2020-09-12 14:34:56 +02:00
Jean-Marc Lasgouttes
efc8d44d09 Fixup 2e784b2f: consider default layout too.
And simplify the test at the same time.
2020-09-03 12:56:33 +02:00
Stephan Witt
0fa4b7e736 #9376 prepare use of Length in lyxrc - move the class Length to support 2020-08-07 09:24:31 +02:00
Richard Kimberly Heck
6834321a50 Allow backspace, etc, to merge paragraphs even if they have different styles.
Patch from Daniel.

This is bug #11917. Master only.
2020-08-02 23:24:22 -04:00
Jean-Marc Lasgouttes
f758894c2f Use Common Number separator instead of European to detect numbers
The is a fixup to commit 611df441. It seems that the wrong unicode
property was selected. It could be that both classes should be used.

Fixes bug #11900.
2020-07-10 18:06:41 +02:00
Juergen Spitzmueller
2c0b650aa6 Do not attempt to mark par break in single-line insets 2020-07-09 18:47:53 +02:00
Jean-Marc Lasgouttes
fc5b22a2f1 Get rid of lyx::next uses for RandomAccessList
These uses are inefficient (a loop really) and require that pit_type
is ptrdiff_t.

Instead, RandomAccesslist::constIterator is renamed to iterator_at and
a version adding a non-const iterator is added. Additionally, the
method retirns end() when position is equal to the size of the
container (see #11861).

lyx::next and lyx::prev are removed, and std::prev is used in the few
places where the code requires it (for no good reason IMO).
2020-05-14 10:35:49 +02:00
Jean-Marc Lasgouttes
c756749991 Revert "Get rid of lyx::next uses for RandomAccessList"
This is not ready (see #11861).

This reverts commit 6d97e39934.
2020-05-13 10:45:25 +02:00
Jean-Marc Lasgouttes
6d97e39934 Get rid of lyx::next uses for RandomAccessList
These uses are inefficient (a loop really) and require that pit_type
is ptrdiff_t.

Instead, RandomAccesslist::constIterator is renamed to iterator_at and
a version adding a non-const iterator is added.

lyx::next and lyx::prev are removed, and std::prev is used in the few
places where the code requires it (for no good reason IMO).
2020-05-12 17:29:21 +02:00
Richard Kimberly Heck
1344caa67a Fix problem with c67b6be77 noted by JMarc. 2020-04-26 16:10:50 -04:00
Richard Kimberly Heck
c67b6be77e Refactor code to avoid the problem fixed at the last commit. 2020-04-25 01:11:30 -04:00
Richard Kimberly Heck
b5a5a529a3 Fix bug #11850.
When we copy the paragraphs, the Buffer members for the insets are
not set. As a result, we crash when attempting to access them.
2020-04-25 01:05:15 -04:00
Richard Kimberly Heck
f7065fa22e Fix bug #11817.
Preserve line spacing when breaking a paragraph at the beginning.
2020-04-08 17:21:43 -04:00
Juergen Spitzmueller
52cd43dfdc Paste some special chars as insets
See #11790
2020-03-23 12:07:47 +01:00
Juergen Spitzmueller
7b3404fcab Don't omit ZERO WIDTH NON-JOINER on clipboard paste
Fixes #11790
2020-03-22 11:07:57 +01:00
Richard Kimberly Heck
7c7ea3113f Use ranges and fix nullptr warnings. 2020-03-16 01:31:30 -04:00
Juergen Spitzmueller
5fc2662b13 Add pref to keep ct markup on copy/paste
Fixes #10278, #10128
2020-01-13 15:20:48 +01:00
Juergen Spitzmueller
ff85641cc0 Whitespace 2020-01-13 09:21:32 +01:00
Juergen Spitzmueller
ac8aa981db Do not track deletion of empty paragraph
Fixes #10412
2020-01-11 18:11:26 +01:00
Juergen Spitzmueller
b2c2a6e15d Correctly handle deleted text on inset-dissolve
Part of #10128
2019-12-27 14:32:20 +01:00
Jean-Marc Lasgouttes
2e784b2f06 Fixup e1be71da: do not enforce plain layout when dissolving
Instead of checking whether the dissolved inset enforces plain layout,
it is better to check whether is uses plain layout.

Fixes #10369.
2019-12-06 10:23:03 +01:00
Richard Kimberly Heck
2c0421f00c Constify 2019-09-11 19:39:03 -04:00
Jean-Marc Lasgouttes
e1be71da59 Reset layout when inserting an inset over full paragraph(s)
1/ When inserting an inset over a selection, it makes sense if the
selection covers a complete or several paragraphs to reset the layout of
the paragraph that contains the inset to plain layout. In general the
inner inset will have the needed layout information and it does not
make sense to keep this information outside.

However, when the inset forces plain layout, it does not make sense to
do that and the outer layout is preserved.

Some code that duplicates what is done in pasteSelectionHelper is also
removed.

2/ Similarly, when dissolving an inset, do not reset the layout of the
first paragraph if the inset was alone in its own paragraph.

Note that this does not work as intended when change tracking is enabled.

Fixes bugs #10266 and #10369.
2019-09-11 10:39:02 +02:00
Jean-Marc Lasgouttes
283ac91aa7 Put end label on own row after display inset
This corresponds to what is done on display. The same should be done
for start label too (e.g. beginning of a proof), but this requires more
work.

This required to move the static function getEndLabel to Text.

Fixes bug #11536.
2019-04-03 11:17:14 +02:00
Juergen Spitzmueller
3ae6bff538 Do not consider deleted labels in ambiguity check
This adds a new (boolean) parameter "active" to the label cache, where
we track whether a label is deleted in ct mode (the same could be done,
if wanted, for labels in notes and inactive branches).

Deleted (inactive) labels are neither considered in the uniqueness check
nor added to the outliner. This also means that undeleted references to
deleted labels are now (correctly) marked as BROKEN.

Fixes: #6563
2018-12-29 10:08:02 +01:00
Jean-Marc Lasgouttes
e4dba53232 Do not remove character at start of paragraph when cutting
The part of code that removed space at start of paragraph have been
there forever, but its intent is unclear. For example, cutting text at
the end of a paragraph will lead to remove space at the start of this
same paragraph.

The removal of this functionality is offset by a rewrite of DEPM that
makes it more thorough.

Fixes bug #10503.
2018-07-22 23:20:21 +02:00
Juergen Spitzmueller
611df441b6 Consider EuropeanNumberTerminator property when determining text direction
Also, use EuropeanNumberSeparator information rather than relying on an
own (incomplete) list of number separators.

Fixes: #4057
2018-07-22 12:38:22 +02:00
Jean-Marc Lasgouttes
789acb4a95 Do not allow completion when there is an active selection
We do it in texted only, mathed is more difficult and not so relevant IMO.
2018-07-03 17:01:20 +02:00
Richard Kimberly Heck
7af1a065e8 update assertion. 2018-06-26 00:26:35 -04:00