Commit Graph

308 Commits

Author SHA1 Message Date
Kornel Benko
49aaf95894 Fix handling of doRemove in advanced search
Amend 11c47ddf
2020-01-01 14:03:21 +01:00
Kornel Benko
48c7d9b028 Do not search in deleted text in change tracking mode 2019-12-29 17:42:18 +01:00
Jean-Marc Lasgouttes
c73d397d32 Do not use same name for members and arguments
Spotted by cppcheck.
2019-10-27 00:06:54 +02:00
Jean-Marc Lasgouttes
714113655a Follow some of the performance advice from cppcheck
Most of that is changing string to string const &.
2019-09-13 16:23:49 +02:00
Kornel Benko
8acbcebf11 Findadv: Add some missing accents.
They are defined in lib/unicodesymols, but were not handled yet.
2019-07-30 15:21:56 +02:00
Kornel Benko
ebc7105c36 FindAdv: Cosmetics
Remove parentheses from return statements,
add '_' to private members
2019-03-21 12:58:16 +01:00
Kornel Benko
e55244ccd8 FindAdv: Added remaining accents(2) dgrave, textdoublegrave, rcap, textroundcap 2019-03-20 23:22:29 +01:00
Jean-Marc Lasgouttes
1c755fefa5 Initialize hasTitle in Intervall constructor
I also moved around some things while I was at it.

Spotted by coverity scan.
2019-03-20 17:26:56 +01:00
Kornel Benko
d7354a1a09 FindAdv: Polishing
1.) Use vector for borders, because any value may be too small
  if there are plenty of accented characters in a paragraph
2.) use '[\S]' instead of '.' in regex for 'accre'. The regex would
  otherwise find also patterns like '\ {some text}'
2019-03-18 18:28:49 +01:00
Kornel Benko
9e825d5035 FindAdv: Added remaining accents cedilla, subring, subhat subtilde 2019-03-18 12:59:40 +01:00
Kornel Benko
13b3808aa0 FindAdv: Casting to satisfy Windows compiler
Thanks to Jean-Marc Lasgouttes
2019-03-18 09:38:34 +01:00
Kornel Benko
bf4394e282 FindAdv: Expand the list of handled chars for ogonek 2019-03-17 13:06:56 +01:00
Kornel Benko
9a1a806b60 FindAdv: Correct start of search if not using regex
Do not try to find pattern inside the leading string.
2019-03-16 11:26:20 +01:00
Kornel Benko
8e7c427c7c Amend 7ac04a2b: Count and display number of replaced strings in FindAdv
We have to know if the previous call to search was a single replace or not,
so that we can correctly initialize the numer of replaed strings.
2019-03-16 08:17:09 +01:00
Kornel Benko
4eacc492a3 Typo 2019-03-13 14:14:35 +01:00
Kornel Benko
7ac04a2b75 Fix #11505. Count and display number of replaced strings in FindAdv 2019-03-13 14:06:18 +01:00
Kornel Benko
c041439c51 FindAdv: Special handling for \dot{i} and 'ß'
Different behaviour in regexp{..} for 'İ' and 'ß':
1.) lowercase routine for 'İ' gives 'İ', so that if we are searching
  while ignoring case, the string '\dot{I}' is converted to '\dot{i}'.
  In this case we have to change it to 'İ' (instead of 'i', as one would expect).

2.) If 'ß' is inserted via keybord on fresh created regexp box it appears as \lyxmathsym{ß},
  if pasted from the lyx-screen it appears as \text{ß}
2019-03-10 00:29:56 +01:00
Kornel Benko
f848183fa8 FindAdv: Expand the list of handled chars for dot below and ring above 2019-03-08 22:44:00 +01:00
Kornel Benko
b702eda4ed FindAdv: Amend cd4ae51f
Prevent to match only part of a macro.
For instance, we want find '\imath' but not '\imathxxxx'
while checking for accents.
2019-03-04 14:37:10 +01:00
Kornel Benko
cd4ae51f77 FindAdv: Amend b21c8b21: Expand the list for handled latin characters
1.) Added for 'breve' and 'grave' accents
2.) Corrected handling for 'i'-accents (allowed \hat{i} _and_ \hat{\imath})
	because of problems with ignoring case
3.) Spaces: Changed some indents in source
2019-03-04 14:05:44 +01:00
Kornel Benko
99bacf006e FindAdv: Handle some more accented latin characters.
Also try to use UTF8 encoded chars instead of their
latex equivalent if possible.
2019-03-03 14:08:27 +01:00
Kornel Benko
b21c8b214d FindAdv: Expand the list for handled latin characters 2019-03-02 22:00:20 +01:00
Kornel Benko
3541a49db4 FindAdv: Try to add the possibility to search for accented characters in regex
The problem is the handling of regex as using math-mode. That is
any accented character is converted to a math macro.
For instance "ä" --> "\\ddot{a}".
Outside of math or regex it is not converted (if used xetex flavour),
but there are other chars which are converted in math and in text (but differently)
For instance "ů"
	in math --> "\\mathring{u}"
	in text --> "\\r{u}"

TODO: determine the still not handled conversions.
It would be nice, if we could persuade math factory to not convert
these characters, but I was unable to find the place where the
conversion actually takes place.
2019-03-02 15:42:38 +01:00
Kornel Benko
9d6b71c6b3 FindAdv: Use isAlnumASCII() instead of std::isalnum()
Thanks Jean-Marc
2019-02-28 13:00:12 +01:00
Kornel Benko
2c5c397afa Amend aaffcd0b: Remove some remnants ... 2019-02-27 10:33:25 +01:00
Kornel Benko
aaffcd0b39 FindAdv: Do not use data from included listing if in search mode
Fixes #11496 	"Find and replace (advanced)" is too slow
2019-02-27 10:17:56 +01:00
Kornel Benko
b1f93e0982 FindAdv: Try to use a better algorithm to find begin of a searched string 2019-02-26 23:00:31 +01:00
Kornel Benko
babb291ef3 FindAdv: Partially revert e69f7022
The slowness returns, but the search works again
2019-02-26 13:24:36 +01:00
Kornel Benko
e69f702275 FindAdv: Fix #11496 -- too slow find
Also added some more macros to handle
2019-02-25 12:12:19 +01:00
Kornel Benko
6a6b670bbd FindAdv: Correctly match '\[' and '\]' in regular expressions with format enabled
We have to check for instances of '{[}' and '{]}' and
omit removing the enclosing parentheses
2019-02-23 13:11:34 +01:00
Kornel Benko
44a06adb6c FindAdv: debug info
1.) Fill the 'head'-member to easier recognize the macro. May be discarded
 later, although it does not take too much run-time
2.) Add some comment
3.) Ignore any macro inside the regex.
2019-02-22 13:21:23 +01:00
Kornel Benko
01fd1f7679 FindAdv: Discard \parbox, \input macros
The languge of these macros does not matter. What's more,
without removing them we may obtain wrong matching.
2019-02-21 20:32:08 +01:00
Kornel Benko
8a0db92523 FindAdv: Handle \shortcut
Essentially remove the header and handle the language inside
\shortcut{...} appropriately
2019-02-21 14:45:41 +01:00
Kornel Benko
a298fc55d9 FindAdv: Added handling for latex environments
1.) Make sure the environment is mentioned in the string for search
  (Added the keyword \latexenvironment{...})
2.) Handle it similar to \textcolor{}

That way we can also search for 'conclusion*' or 'summary' etc
in Additional.lyx.
2019-02-20 14:14:50 +01:00
Kornel Benko
0a2dda0904 Findadv: Added handling for frontmatter macros
title, subtitle, author etc.
2019-02-19 23:11:09 +01:00
Kornel Benko
96ca66d664 FindAdv: Handle more cases
Some macros need:
1.) Take care of case sensitivity
2.) Better handling of used argument values
3.) Cleaner list-environment search
4.) Remove superfluous '~' if searching for description or labeling env
2019-02-18 00:40:55 +01:00
Kornel Benko
dfbe29317d FindAdv: Even more fine tuning 2019-02-16 18:39:10 +01:00
Kornel Benko
faf7f0666f FindAdv: More fine tuning 2019-02-13 13:41:57 +01:00
Kornel Benko
8d752b68e9 FindAdv: Fine tuning 2019-02-12 14:21:14 +01:00
Kornel Benko
a47dbed6bd FindAdv: Try to find real start of found match
Sometime it happen that the selection contains area which was skipped
in splitOnKnownMacros().
So we check, if a shorter selection would give the same mach size.
2019-02-11 13:13:28 +01:00
Kornel Benko
f19bd163de FindAdv: Add handling of begin{multicols}[...][...]{...}
Also
a.) try to speed up regex search using non-greedy mode (.*?)
b.) remove '\n' completely in searched strings if it is not surrounded with
	aplanumerical chars
2019-02-10 18:00:55 +01:00
Kornel Benko
7fa1244dd8 Findadv: Add handling for powerdot macros
With format enabled, these macros were hard to process:
	lyxslide, twocolumn
2019-02-07 13:35:47 +01:00
Kornel Benko
50550a215f Findadv: Handle \lettrine{} in initials.module
The problem here is, that selecting any subset of a \lettrine{}
line always creates an initials header. That makes it impossible
to our search engine to find strings, because the regex does not
contain that info. So we have to discard the leading \lettrine part
completely.
We place now a marker (\endarguments) to determine that removable
part.
2019-02-05 08:04:47 +01:00
Kornel Benko
187b518648 FindAdv: to please cppcheck ...
Initialize class elements
Removed unused method
Added 'explicit' keyword
Optimize handling for sizes ( \tiny, \small, etc)
2018-12-18 06:53:58 +01:00
Kornel Benko
a1a7c21871 FindAdv: Amend 4276e1b0 2018-12-17 10:33:23 +01:00
Kornel Benko
4276e1b01e FindAdv: Handle also sizes of characters 2018-12-16 14:50:38 +01:00
Kornel Benko
2682170556 FindAdv: Comments 2018-12-14 19:51:24 +01:00
Kornel Benko
358626b735 FindAdv: Add handling spaces, dots, quotes ...
Treate spaces, dots and quotes as ordinary characters
Also discard length values for hspace,vspace and mspace
2018-12-13 17:12:57 +01:00
Kornel Benko
8a29bdb3d1 FindAdv: Added code, href, url and footnote to handled search formats
Remark: Inside code{} and footnote{} are the language settings ignored.
2018-12-11 17:27:50 +01:00
Kornel Benko
cd94180492 FindAdv: Simplify search for chars '&', '%', '#' and '_'
This is not possible for '$', because of the latex-meaning to
start/end math inset.
Therefore, if not ignoring format, we still have to use
[\\][\$] in regex in order to find '$' in text.
2018-12-05 13:36:43 +01:00