Commit Graph

463 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
ac248e392d Get rid of Qt4 code in src/
Qt4 code has been identidifed by
  git grep -l 'QT_VERSION.*\(0x050000\|0x04\)' src

Uses of QT_VERSION_CHECK have been checked too.

been used to remember what places need further work.

Then remaining Qt4 references have been searched using
  git grep -i qt4
  git grep -i 'qt 4'
and relevant issues have been either fixed or noted in the new
TODO.killqt4 file.
2022-11-18 17:19:50 +01:00
Kornel Benko
9be6a425df Workaround for advanced search in 'uncover'-inset.
Allows for matches inside style Uncover if used
	Settings->Adhere to search string formatting
This does not cover all of #12594 though.
2022-11-02 10:33:29 +01:00
Jean-Marc Lasgouttes
337cc97174 Use auto const & when possible to avoid copies
In several range-based for loops, implicit copies are made. Remove
that when possible, and try to shut converity up otherwise.

Fixes issues found by coverity.
2022-08-30 17:31:37 +02:00
Kornel Benko
d0862d59e6 FindAdv: Remove needless functions 2022-06-06 13:18:08 +02:00
Kornel Benko
46c573c082 FindAdv: Use modified check to determine if char is a word-char.
Amends 652ffc9c(3)
2022-05-29 14:12:38 +02:00
Kornel Benko
82af8778f1 Introduce isNumberChar(char_type) function
In FindAdv we use Qt to interpret regular expressions.
Regex uses for instance '\w', '\d' etc.
'\d' finds not just '0-9' but also e.g. '߂' (Nko Digit Two: U+07c2)
'\w' includes also such numbers.

ATM, only FindAdv uses this function.
2022-05-29 12:16:53 +02:00
Kornel Benko
0d6e3bcdc3 FindAdv: Amend 652ffc9c(2): Fix handling search for whole words if in mathed.
Didn't know, how to get char-value cursor is pointing to.
Hopefully someone knows a better way as in this patch.
2022-05-28 21:17:13 +02:00
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
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
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
8e256fbf0f FindAdv: Do not insert space for '\n' if there already are spaces around 2022-05-11 17:42:50 +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
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
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
Kornel Benko
cbe2f61396 FindAdv: Re-add 'size' to the list of possible ignored formats 2022-04-30 09:30:15 +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
Kornel Benko
769df229dc FindAdv: Avoid some duplicated code
Also handle (== ignore) \textgreek{} and \textcyrillic{} commands
2022-04-27 15:57:24 +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
Kornel Benko
d09f5ce1d0 FindAdv, Debug: Added new debug level :findverbose
With the debug-level 'find' there are now less output.
The original output can be received now with debig-level 'findverbose'

Also constructions like
 LYXERR(Debug::FIND|Debug::FINDVERBOSE, "...");
are now possible.
2022-04-19 13:41:38 +02:00
Kornel Benko
28b206665f FindAdv: Convert '\%' in a regex to '%'
Regex contents comes from handling hullRegexp, so we
have to reverse some its handling, among others also for the char '%'
2022-04-16 15:10:33 +02:00
Kornel Benko
45756a50b4 FindAdv: Handling of '%' in searched string while not ignoring format
Difficult to decide, when to remove the sequence '%\n'.
The sequence is OK for latex output as a command separator,
but must be removed in searched string.

Alas, not all occurences are wrong. Sigh.
2022-04-15 17:09:08 +02:00
Kornel Benko
c2229d388b Find: Renamend for_searchAdv to for_serach in src/OutputParams.h
Since this variable is used by quick find too, the naming was misleading
2022-04-12 18:02:12 +02:00
Kornel Benko
1f7d90d636 Find: Advanced + Quick:
Expand list of quotes to include also '» « › ‹'
Enable quick find to search for quotes too
2022-04-08 08:40:32 +02:00
Kornel Benko
aa66663364 FindAdv: Amend 58f70b9d
Consider plain-quotes, inner-quotes
1 independent if in regex or text
2 independent of quote style
3 independent of using dynamic marks
2022-04-06 19:00:20 +02:00
Juergen Spitzmueller
31ac9ed59f Fix indentation 2022-04-04 12:02:25 +02:00
Juergen Spitzmueller
bbf21502bf Initialize member 2022-04-04 11:43:55 +02:00
Kornel Benko
c559b69fe1 FindAdv: Amend 4125f6a9
Variables regexError and regexError only defined
when searching via QT-version >= 5
2022-04-03 18:05:15 +02:00
Kornel Benko
4125f6a9d3 FindAdv: Omit possible empty patterns
Normally this is done by the GUI, but searching for e.g. LyX-Comment
allows empty patterns.
2022-04-03 13:21:02 +02:00
Kornel Benko
4feb6aaea9 Make clang happy
Omitting 'error: comparison of integer expressions of different signedness'
2022-04-02 17:01:02 +02:00
Kornel Benko
83e65161a8 FindAdv: Ignore comment-feature (but not its content)
TODO: Handle 'comment' like other features, but this needs more thinking.
2022-04-01 13:45:57 +02:00
Juergen Spitzmueller
1aa449785e Indentation 2022-04-01 11:34:26 +02:00