Commit Graph

617 Commits

Author SHA1 Message Date
Daniel Ramoeller
2b493ff70f Word selection on mouse motion
Partial fix for bug #9160.
2022-05-17 18:45:31 +02:00
Jean-Marc Lasgouttes
e6f5f428d7 Fix crash with LFUN_LAYOUT with multicell selection
This lfun (like several others) does not work with multicell
selection. Disable the lfun in this this case for now, until a nice
solution is found.

Fixes bug #12530.
2022-05-09 17:54:15 +02:00
Jean-Marc Lasgouttes
809a063358 Avoid crash when extending word selection
This happens when the cursor goes into a deeper inset, since
selectWord() was called on the wrong Text object.

Additionally, fix the new word selection when cursor goes before
existing selection.

Fixes bug #12529.
2022-05-05 11:13:29 +02:00
Juergen Spitzmueller
92aa12317e Reset font formatting of inset entries on creation (#11961) 2022-02-16 14:25:25 +01:00
Juergen Spitzmueller
6adb083384 Use copy 2022-02-16 14:24:46 +01:00
Juergen Spitzmueller
9729b22d9e Always update buffer when language is being changed (#12481) 2022-02-15 16:17:19 +01:00
Juergen Spitzmueller
13f9edb770 Reset font when leaving insets while auto-inserting (fixes #12477) 2022-02-14 08:46:11 +01:00
Jean-Marc Lasgouttes
2da183bf4f Check layout type when inserting inset over selection
When inserting inset over a selection, the layout is transferred if
the inset covers full paragraphs.

This is not the right policy in the case of environments. Until proper
code is written and tested, limit ourselves to command layouts.

Fixes bug #12251.
2022-01-24 19:24:52 +01:00
Jean-Marc Lasgouttes
542445d07d When pasting text, keep line breaks when "parbreak is newline"
This is much easier for listings, ERT or Verbatim.

Fixes bug #8026.
2021-12-26 20:22:01 +01:00
Juergen Spitzmueller
e366dba9bf Factor out Buffer::requestSpellcheck() function 2021-11-25 17:04:17 +01:00
Jean-Marc Lasgouttes
2311f42f41 Make primary-selection unknown when not supported
This lfun will not appear in menus anymore in macOS and Windows.

Part of bug #12436.
2021-11-22 10:30:43 +01:00
Jean-Marc Lasgouttes
2f236b01e0 Make sure that language is "latex" in InsetArgument when pass-thru.
The code that determine whether an InsetArgument is passThru is
complex and lives in updateBuffer.

This patch factors out the code in a new init method and calls it also
in doInsetInsert when inserting a InsetArgument.

Fixes bug #12143.
2021-10-21 19:14:06 +02:00
Juergen Spitzmueller
3f2510991d Recheck whole buffer after word has been added to/removed from document dic. 2021-08-21 15:18:30 +02:00
Jean-Marc Lasgouttes
008a0825e8 Always remove selection after cursor up/down
When the cursor cannot move on cursor up/down, at least the selection
should be cleared (when not selecting).

To detect this, the method Cursor::upDownInText has been modified to
return true when cursor is at top/bottom of inset, but there is some
room above/below.

Moreover, introduce the functions LFUN_FINISHED_UP/DOWN, which is
dispatched at upper cursor level as long as no local movement is
possible. This allows to handle differently the original char moving
action and its consequences.

Fixes part of bug #12310.
2021-06-30 16:51:58 +02:00
Jean-Marc Lasgouttes
8d90bb9991 Always remove selection after cursor left/right
Example: when a selection is set, a `Left' cursor movement would not
reset selection when the cursor was at the beginning of buffer.

To fix this, it is necessary, when cursor is in top-level text, to
avoid the mechnanism (undispatched cursor) that sends the action to the
upper level (necessary when the cursor leaves an inset).

The change is mechanical and is done for : char-backward,
char-forward, char-left, char-right, word-left, word-right, word-left,
word-right. It might be possible to factor this code a bit, but there
is no evident solution.

char-up/down are *not* handled at this point.

Fixes part of bug #12310.
2021-06-30 16:41:18 +02:00
Juergen Spitzmueller
70bcffca9c Add missing counter code 2021-05-07 13:38:43 +02:00
Jean-Marc Lasgouttes
efbc37926f Set explicitly outer font when inserting text inset.
Now it is possible to set this font directly instead of relying on
metrics() side effects. Do that to avoid crashes due to bad
interactions.

This implements the new scheme that was mentionned in 5a58ca65.

Fixes bug #12204.
2021-03-25 11:26:44 +01:00
Juergen Spitzmueller
c8feef2e23 Add way to remove items from document dictionary 2021-03-07 18:23:07 +01:00
Stephan Witt
07122f066b Refactoring: move check for match in spellignore() to buffer params. 2021-03-07 17:46:01 +01:00
Stephan Witt
3f75fb7a48 Amend 07396ab244 - fix white space. 2021-03-07 10:46:00 +01:00
Daniel Ramoeller
5d269df606 Do not toggle on (all) layouts in force plain
Fix for #12179.
2021-03-06 20:25:52 +01:00
Juergen Spitzmueller
07396ab244 Meet per-document spelling dictionaries (fixes #86 [sic!])
Now who can beat that? ;-)
2021-03-06 16:53:33 +01:00
Juergen Spitzmueller
92c6c3b950 fix indendation 2021-03-06 16:15:10 +01:00
Juergen Spitzmueller
f1f475e1d3 Add LFUN_FONT_NO_SPELLCHECK 2021-03-05 18:23:38 +01:00
Juergen Spitzmueller
23fc1b270d Remove redundant call (amend 2b7fae04f3) 2021-03-05 07:54:17 +01:00
Juergen Spitzmueller
2b7fae04f3 Fix limiting of absurdly large input to thesaurus (#10528) 2021-03-05 07:51:49 +01:00
Jean-Marc Lasgouttes
5a58ca6576 Fix caret height when inserting new inset
For now, the simplest thing to do it to compute metrics in all cases
before calling setCurrentFont().

In 2.5, a better approach will be to add a new virtual function
InsetText::setFont that will set correctly TextMetrics::font_ (a cache
of the reference font).

Fixes bug #12126.
2021-02-14 21:39:15 +01:00
Jean-Marc Lasgouttes
566b4de5cd Fix off-by-one condition when right clicking over selection
Fixes bug #10429.
2021-01-19 19:24:10 +01:00
Juergen Spitzmueller
b5f83881ab Amend aaaae562db 2021-01-09 09:17:41 +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
Juergen Spitzmueller
aaaae562db Fix nesting issue in environment-split (#11971) 2021-01-07 11:53:35 +01:00
Jean-Marc Lasgouttes
baae41bd05 Remove extra spaces 2021-01-06 11:10:11 +01:00
Juergen Spitzmueller
18f7dce3d9 Implement inset-split (only for text insets for now) (#10260) 2020-12-24 10:48:52 +01:00
Yuriy Skalko
e292dd70bf More enums & includes refactoring 2020-12-06 18:26:41 +02:00
Yuriy Skalko
c0a5987181 Better naming for enums 2020-12-01 00:46:21 +02:00
Yuriy Skalko
6354ad60b4 Refactor InsetQuotes.h enums 2020-12-01 00:46:09 +02:00
Yuriy Skalko
7779316e6c Include standard <regex> 2020-11-29 15:27:28 +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
Jean-Marc Lasgouttes
c286cad565 Reset caret size when inserting text over a selection 2020-10-17 20:29:16 +02:00
Yuriy Skalko
919a06718a Constify 2020-10-12 15:06:16 +02:00
Yuriy Skalko
fe85162a29 Refactoring 2020-10-05 14:55:00 +02:00
Yuriy Skalko
715b8cda54 Refactoring based on cppcheck suggestions 2020-10-03 13:39:51 +02:00
Jean-Marc Lasgouttes
a2b754b10b Fixup 7d965319: reset cursor font at a finer level 2020-10-01 14:19:09 +02:00
Jean-Marc Lasgouttes
7d96531909 Fix bug where cursor size is not reset correctly.
A couple of calls to setCurrentFont fix the issue, but there has to be
more cases to catch. I am not sure why it used to work.
2020-10-01 12:44:38 +02:00
Jean-Marc Lasgouttes
9b18a9b609 Fixup e1be71da5: avoid duplication of layout
If the containing paragraph has kept its layout, reset the layout of
the first paragraph of the newly inserted inset.
2020-09-07 14:16:47 +02:00
Pavel Sanda
28968b1f0d Add required elements in the layouts to support DocBook.
Slightly modified patch from Thibaut Cuvelier.
2020-07-07 09:49:48 +02:00
Juergen Spitzmueller
9f13bb73f8 Consider nesting level when autonesting 2020-06-25 10:37:04 +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