We now use a new variable, "wrap", to track if a wrap should be
done, which is true either if "auto_wrap" is true or if the user
chooses to wrap in the dialog.
This preserves the meaning of the "auto_wrap" variable and also
removes the confusion of why the previous code of
if (!auto_wrap) {
...
}
if (auto_wrap) {
did not use an "else" instead of the second "if".
No change in functionality.
Language settings will be ignored if
a.) User selects if with setIgnoreFormat("language", true, true)
or
b.) The pattern does not contain lang-specs other than the default language of document
or
c.) The pattern contains math parts
Using unordered_map instead of map.
Reasons:
1.) The relevant maps contain 166(Keys) and 649(Accents) entries.
This mean that average access with 'map' needs 8 to 10 compares to find the value.
2.) Since we are using at least c++11, the unordered_map is available
2.) increasing the maps (in future) needs not to be considered anymore, because
the access-time will not increase.
In case of search with format:
If the pattern contains language spec different to the document language
then do not ignore language setting.
Also renamed 'matchstart' in FindAndReplaceOptions to 'matchAtStart'
Since commit c600906d92 all matches are match-results of examined strings starting
with a character of the same cursor depth, we can be sure to match the same string again if:
1.) the number of characters to the end of the examined strings match.
2.) the match-lengths are identical
1) Take care of different input if changed the search-mode (with/without format)
This amends ec387b6d
2) Make the braces used in text to be treated as single characters
e.g. transform '\braceleft' to some unicode value
3) Try to use '$' as 'end of sequence' in regex
We have to remove '}' and '\n' chars from the examined string
In format-search the chars '{' and '}' are understood as latex parentheses, which normally are not
part of text and are discarded.
Instead we fake them as if they were a char like \backslash or \guilemotright or such.
Makes the code with less exceptions
(no need to differentiate beteen use_regex and !use_regex)
Move the creation of regexes to own subroutine (Handles '#if QTSEARCH ... #endif')
Use cursor position differences instead of length of matched string. This is important for putSelectionAt()
Otherwise we are unable to distinguish text from latex commands.
For instance '\color{blue}' in text-part is normal text, while othervise
it defines following characters as being blue colored)