Commit Graph

28216 Commits

Author SHA1 Message Date
Kornel Benko
567d0e8fb4 FindAdv: Amend 652ffc9c: have to check inTexted() before using Paragraph 2022-05-26 17:17:49 +02:00
Kornel Benko
1ef1808c93 Amend b73ab025: Fix compilation with gcc-12 2022-05-26 14:05:49 +02:00
Kornel Benko
652ffc9c84 FindAdv: If searching for whole words, handle also the case that we are starting in the mid of a word.
In this case we skip the undesired word-characters before starting the search.

There are still some inconsistencies between LyX and Qt of 'what counts as a word-character',
but too hard to resolve.
2022-05-26 13:32:25 +02:00
Kornel Benko
bf60c61066 FindAdv: Fix expression checking for 'int' as if it were bool
Since the element 'match_len' in class MatchResult is an integer,
the check 'if (!match(...).match_len))' is changed to
'if (match(...).match_len) <= 0)'
2022-05-25 21:34:17 +02:00
Kornel Benko
df82386ce6 FindAdv: Attempt to make the code less crabbed
1.) The type of variable at_begin changes from bool to enum matchType
        true -> MatchStringAdv::MatchFromStart,
        false -> MatchStringAdv::MatchAnyPlace
2.) discard default parameter-values of
        MatchStringAdv::operator()
        MatchStringAdv::findAux()
2022-05-25 20:43:49 +02:00
Kornel Benko
d12bf6f979 FindAdv:
1.) Changed arrays dept and closes to vector-type because of runtime error in UserGuide.lyx
    with a big paragraph (size > 8900 chars) contained too many opening parentheses
2.) Removed one creation 'textcyrillic'-key because it is later anyway created
3.) Most important (thanks to Scott who found the failure)
    Move the check if the found string really is part of MATH to
    the relevant place.
    Without this change the search using 'Search only in maths' will fail miserably.
2022-05-24 23:41:31 +02:00
Juergen Spitzmueller
cd27fec2d7 BufferParams::copyForAdvFR(): include quote style 2022-05-23 14:32:01 +02:00
Kornel Benko
9e19258478 FindAdv: Do not search for accents if the command-parameter contains '\\'
The only exception are command-parameters '\\i', '\\imath' or '\\jmath'.

Example '\ddot{\\imath}'
2022-05-20 12:46:26 +02:00
Jean-Marc Lasgouttes
c6725df2db Fixup d723b903: Fix slow display of large paragraphs
When implementing multi-row string breaking, an extra createLine()
statement, which made sense in the original code, was kept by mistake.
This basically made the mechanism ineffective, because it created one
row with the correct length, plus a second one with all the remaining
text, which would have to be itself broken. This went undetected
because the display is still correct.

Additionally, this issue polluted the break cache to the extent that
the hit rate could be 0%.

Together, these two effects created a major slowdown with a document
containing a single ~30000 characters paragraph.

Fixes bug #12534.
2022-05-19 16:18:24 +02:00
Jean-Marc Lasgouttes
6dd5656a2c pmprof: fix missing output in the 100% miss case
Also update to the latest version of pmprof.
2022-05-19 11:37:51 +02:00
Juergen Spitzmueller
a77c84a0b4 Allow for several (comma-separated) PackageOptions 2022-05-19 10:31:37 +02:00
Jean-Marc Lasgouttes
32437bd59f Fixup 5f8959d4: keep cursor font when there was no selection
When toggleFree is called without a selection, the only result is to
change the cursor currentfont.

In the other cases (selection or implicit selection), we want to reset
the cursor font from the text font.

Fixes bug #12518.
2022-05-17 23:10:31 +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
5f8959d40e Make sure that current cursor font is updated when changing font
Fixes bug #12518.
2022-05-17 12:15:58 +02:00
Kornel Benko
1464bd3f3f FindAdv: Amend(2) f845a4e9
Removing '\n' like in previous version with utf8-strings
This is needed e.g. for display math, which comes as
	"\n\\[\n.....\n\\]\n"
2022-05-14 14:49:52 +02:00
Kornel Benko
cd6d21ebb3 FindAdv: Amend f845a4e9
Also do not remove '\n' if in non-format-search mode. Otherwise
'\n' cannot be found with regex '\s'
2022-05-14 09:51:23 +02:00
Kornel Benko
f845a4e9a3 FindAdv: Do not handle stale empty latex commands if not in format-search mode
In non-format-search mode, we do not have any latex commands here.
2022-05-14 09:25:06 +02:00
Kornel Benko
115d6ceedd FindAdv: Don't check on '\\\\\n' if ignoring format
Since it can only happen if the lyx source contains two backslasches before
the inserted newline. And here it is the wrong case.
2022-05-14 08:56:00 +02:00
Kornel Benko
b0323628af FindAdv: Amend 6c735efb: Resolve some conflicts regex vs. math meaning of '$' 2022-05-13 12:00:47 +02:00
Kornel Benko
6c735efb1f FindAdv: In format search could '$'-char be interpreted as math-start.
To handle this case, we use '\lyxdollar' string instead.

Also try to handle '\n' in the docstring directly instead in the
string already converted to utf8.
(The utf8-version is still there, but commented out)
2022-05-13 09:30:30 +02:00
Kornel Benko
895aa9cd0f FindAdv: Remove invalid closings
If the searched area contains deleted parts, there may be more closing
as opening parentheses in latex output. We have to remove them before
further processing.
2022-05-12 13:22:21 +02:00
Kornel Benko
4b41f54575 FindAdv: Use unicode for space where possible
Search for different space-types should be done with
regular expression '\s'
2022-05-12 13:20:24 +02:00
Daniel Ramoeller
4dd1fbbce0 Use "Auto" value on cursor width spinbox
Fix for bug #12515.
2022-05-11 18:05:47 +02:00
Kornel Benko
8e256fbf0f FindAdv: Do not insert space for '\n' if there already are spaces around 2022-05-11 17:42:50 +02:00
Juergen Spitzmueller
8bf45dd3ea Shuffle and add some shortcuts 2022-05-10 13:29:51 +02:00
Kornel Benko
62ab563c25 FindAdv: Use private variable for_search
Using the new inline statements
	find_effective(), find_with_non_output(), find_with_deleted(),
	find_set_feature(), find_add_feature() and find_clean_features()
makes the code a slightly better readable.
2022-05-09 22:11:38 +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
Kornel Benko
441b0eab23 FindAdv: Amend 64af721a
The space handling is a nightmare.
2022-05-08 22:43:56 +02:00
Kornel Benko
64af721adc FindAdv: Handle normal and protected space also inside regular expression 2022-05-08 20:24:43 +02:00
Kornel Benko
286dcfc9c7 FindAdv: Correct the 'fix' in 4bb427a2
:(
2022-05-08 15:32:13 +02:00
Kornel Benko
4bb427a244 FindAdv: Amend 627cd6de: Use '~' instead of "\\ " for search if possible
Also fix a thinko in interpreting the found values.
The match_len describes the length of the second regex field,
while matchend is the length of the search field 0.
2022-05-08 14:30:45 +02:00
Kornel Benko
627cd6dec2 FindAdv: Simplify search for space also if not using regex
In the pattern-string convert occurences of
' ', '~'
and the values we get with
	space-insert normal
	space-insert protected
to "\s+".
2022-05-06 17:16:49 +02:00
Kornel Benko
70a762f91c FindAdv: Small improvements 2022-05-05 15:56: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
Kornel Benko
9f30de3c5d FindAdv: Partly revert 02c7dbb8. Handle the space in Paragraph.cpp instead. 2022-05-04 15:59:57 +02:00
Kornel Benko
02c7dbb824 FindAdv: Better handling of lists
Still not optimal if searching different languages inside a list.
2022-05-03 16:33:53 +02:00
Kornel Benko
6a70a26a4a FindAdv: Debug messages 2022-05-01 16:03:45 +02:00
Juergen Spitzmueller
c0a3d654ff Add GUI for search-ignore 2022-04-30 14:23:54 +02:00
Kornel Benko
cbe2f61396 FindAdv: Re-add 'size' to the list of possible ignored formats 2022-04-30 09:30:15 +02:00
Kornel Benko
48c069fa8a Amend a83159f0: Use logical operator ||.
Clang is not mocking here, but it looks more consistent.
2022-04-29 19:56:12 +02:00
Kornel Benko
531fed9543 FindAdv: Fix the length of leading string
We are removing leading values from the start of string, so
the size of removed data was wrong because s.find() could find
a position inside the leading part.
2022-04-29 19:23:50 +02:00
Scott Kostyshak
a83159f051 Fix Clang 14 warning -Wbitwise-instead-of-logical
Use the boolean operator '||' with bools instead of the bitwise
operator '|'.
2022-04-28 21:40:00 -04:00
Kornel Benko
769df229dc FindAdv: Avoid some duplicated code
Also handle (== ignore) \textgreek{} and \textcyrillic{} commands
2022-04-27 15:57:24 +02:00
Juergen Spitzmueller
e6a7137a53 Mark aliases in the description 2022-04-24 16:51:42 +02:00
Juergen Spitzmueller
64ec812da5 Amend d8f540f51
Properly handle aliases
2022-04-24 16:51:16 +02:00
Juergen Spitzmueller
d8f540f51b Properly ignore debug levels in the GUI
Not only none and any, but also the aliases.
2022-04-24 14:21:56 +02:00
Kornel Benko
98cc6acd0b Amend 3b7a79f1: Use Debug::base_type instead of 'unsigned long long' where possible 2022-04-24 13:52:46 +02:00
Kornel Benko
3b7a79f137 FindAdv: Amend d09f5ce1: Added new debug level :findverbose
Fix the GUI handling for the new value using now 'unsigned long long' instead of 'int'
2022-04-24 13:27:36 +02:00
Kornel Benko
c7b6bf4519 FindAdv: Search also if layout of the searched paragraph has 'inpreamble' set
Using 'force' in call to TeXOnePar() enables the search of any string in document.
2022-04-23 20:33:47 +02:00
Kornel Benko
e774ec1876 FindAdv: Fix search for '}'
Problem occured if
1.) not using regex and
2.) search without format and
3.) the search pattern ended with '}'.

then this last char '}' in the search pattern was discarded.
2022-04-19 23:28:27 +02:00