Commit Graph

39747 Commits

Author SHA1 Message Date
Kornel Benko
0964ffb266 FindAdv: Remove left over comment character
Sometimes language spec starts with "% ". This happens in Japaneese documents
containig English text at start of paragraph.
2018-11-16 12:12:06 +01:00
Kornel Benko
06c05430d9 FindAdv: Added lyx-function search-ignore
Enable/disable ignoring the specified type
	language: e.g. british, slovak, latin, ...
	color:	blue, red, ...
	sectioning: part, chapter, ..
	font:
		series: bold, ...
		shape: upright, italic, slanted
		family: serif, monospace ...
	markup: enphasize, noun
	underline:
	strike:

Examples:
	search-ignore language true
	search-ignore shape true
2018-11-15 14:20:50 +01:00
Kornel Benko
702c495e98 FindAdv: Significantly increase the search speed
The needed time to find a simple string dependes on the
paragraph length was O(n^2)
Now it is down to O(n).
Before:
	To determine if the pattern matches we compared the
	paragraph from current position to the its end.
	Increment current position if no match
Now:
	Check if the character at current position has at least
	the needed features (text, color, language etc)
	If not, Increment current position
	else proceed as before
2018-11-13 12:11:33 +01:00
Enrico Forestieri
1bdba953a5 Fix cursor left/right navigation in overset, underset, and stackrel
Before this commit, navigating with the cursor was visiting either
the nucleus or the script depending on the direction (left or right)
of the cursor movement. Now the 2.3.x behavior of always going through
the nucleus is restored (at least for overset and underset, as stackrel
seems to behave oddly also in 2.3.x).
2018-11-12 19:05:09 +01:00
Kornel Benko
636bb6c2d9 FindAdv: Polishing search with regex containing '.'
Also added missing math env alignat
Modified handling of longtable/tabular
Added a routine to count for valid chars. This is needed
for detection of word boundaries.

Due to detection conflicts
	regex '.*' vs match of word-boundaries in MatchStringAdv::operator()
we need to use '\b' in regex explicitly. E.g. '\b.*\b'

The backward search works, but
1.) only in current paragraph (this is the same as before)
2.) only in the same language environment.
2018-11-12 12:28:31 +01:00
Jean-Marc Lasgouttes
1ff0816a02 Typo 2018-11-12 11:41:54 +01:00
Enrico Forestieri
eaf7413020 Update layout format number 2018-11-10 16:07:07 +01:00
Enrico Forestieri
9c3bbeefab Fix bug #11367
The overset, underset, and stackrel insets behave like the script
rather than the fraction inset.
2018-11-10 15:50:51 +01:00
Enrico Forestieri
77234fecd8 Restore correct left/right navigation in root inset
Now all cells are correctly visited in sequence when moving with
cursor left/right.
2018-11-10 14:55:00 +01:00
Jean-Marc Lasgouttes
93db2bd08e Make cell-forward/backward cycle in math
Make cell-backward put the cursor at the end of cell when using
mac-like cursor movement.
2018-11-09 16:05:09 +00:00
Jean-Marc Lasgouttes
ee9451aaf5 improve left/right navigation in root inset
Now the cursor is correctly set when changing cell with xursor left/right.
2018-11-09 16:05:09 +00:00
Jean-Marc Lasgouttes
7055bb0098 Change IgnoreFormats to a proper class
Instantiate a global variabble holding the formats and allow to modify
it using the helper function setIgnoreFormat.
2018-11-09 16:05:09 +00:00
Kornel Benko
f5d5777a86 FindAdv: Polishing
1.) Added \textmd to be ignored (sometimes it is used and sometimes not)
2.) Typo: multiline --> multline. Searching in 'multline' caused a crash
	because processing all of the '{' and '}' in the content of this math
	exceeded the size of the interval field.
2018-11-09 13:49:05 +01:00
Juergen Spitzmueller
523d284729 missed this. 2018-11-09 11:47:51 +01:00
Juergen Spitzmueller
a5004a394a Fix thinko
Actually use the replaced path string :-/
2018-11-09 11:28:38 +01:00
Kornel Benko
0c05432284 FindAdv: Polishing
1.) Handle some unclosed parentheses
	Sometimes \shortcut is not correctly closed
2.) Added \ldots as known char
3.) Discard some shapes (circlepar, droppar, ...)
4.) Omit resulting empty string and use some value
	which cannot be matched instead
2018-11-08 09:59:51 +01:00
Jean-Marc Lasgouttes
2daf493cbc Fixup 097da3a9: fix horizontal navigatiion in InsetMathRoot
Exchanging cells 0 and 1 requires to implement idxBackWard/Forward.
2018-11-07 11:53:00 -10:00
Jean-Marc Lasgouttes
974766cd1c Fixup 097da3a9: update the math parser
One has to account for the change in cell numbering.
2018-11-07 08:29:46 -10:00
Kornel Benko
88428123ea FindAdv: Optimize for long matches
Still, if the matched string is at a rear part of a very long
paragraph, the search is way too slow.
2018-11-07 13:14:50 +01:00
Jean-Marc Lasgouttes
b0937fb93e When inserting math inset over selection, place cursor better
This is a follow up to 503c7c16.

The new argument for placing cursor after insertion of inset is:
* if inset has no cell, do nothing
* otherwise, place inset in entry cell.
  + if entry cell is not empty (we pasted a selection), go to next cell
  + if this next cell does not exit, stay after the inset.
2018-11-06 22:48:53 -10:00
Jean-Marc Lasgouttes
097da3a943 Change cell numbers so that 0 is the main cell
This leads to code simplification in overset, root and underset.
Further simplification is possible.
2018-11-06 22:48:53 -10:00
Kornel Benko
9d304c0a1d FindAdv: Discard table decorations
That way we do not match the whole table but only the cell contents.
The problem I had was
1.) Document language Spanish
2.) Table (copied from English doc) => language English
3.) All cell contents Spanish

Now search for English text led to a selection of the whole
table, although there was no English content in any cell.
2018-11-07 09:35:16 +01:00
Kornel Benko
4f1cd00b02 Findadv: Initialize the position of first unprocessed open parentheses
Not initializing caused some wrong matches.
2018-11-06 15:28:43 +01:00
Kornel Benko
e487274ff4 Findadv: Polishing
1.) Do not remove '{}' unconditionally from \item parameter
2.) Do not output last empty entry
2018-11-05 12:58:45 +01:00
Jean-Marc Lasgouttes
7db99672e6 Avoid extra space in tooltips
When using QTextDocument to check the natutal size of a text, one has
to remove the text margin, which is not useful here.

Fixes bug #11353.
2018-11-04 14:02:42 -10:00
Kornel Benko
70e2f09c4f Findadv: Some glitches found while searching for English text in fr/UserGuide.lyx
Ignore \index
Handle \og and \bg as characters
Remove space in empty list-item (description or labeling)
2018-11-04 21:41:04 +01:00
Kornel Benko
aa68dcefa0 Findadv: 'Optimized' detection of matched string
This is clearly a hack, because I don't understand why the
previous code did not work.
2018-11-04 14:57:40 +01:00
Jean-Marc Lasgouttes
1bed76e2a1 Fix selection of unmarked RtL text
With Qt 5.11 at least, RtL text will be drawn RtL even when the
(undocumented) flag Qt::TextForceLeftToRight is applied to the
QTextLayout object. This creates selection issues for Hebrew text
marked as English.

The solution is to do the same as in breakAt_helper, that is prepend
the string with a direction override unicode character.

Doing this requires to introduce a TEXTLAYOUT_OFFSET constant that has
to be used wisely to account for this extra character.

Fixes bug #11284.
2018-11-04 08:23:49 +00:00
Jean-Marc Lasgouttes
76e99e9a20 Remove old workaround that is not needed anymore
This causes a compilation error with boost 1.69.

Fixes bug #11349.
2018-11-04 08:23:49 +00:00
Kornel Benko
5c2f29d024 findadv: Output language chage in ANY case, if outputting for search
Without this, the first \item entry in a list does not specify the language
in latex output. But we need it if we do not ignore language in search.
2018-11-03 15:05:38 +01:00
Richard Kimberly Heck
01af66d658 Minor fixes 2018-11-03 10:00:48 -04:00
Richard Kimberly Heck
c9be8bff74 Speed up parenthesis conversion routine for Hebrew. Patch from Guy. 2018-11-03 09:58:32 -04:00
Kornel Benko
23e2ea358f findadv tests: Remaining test passes now too 2018-11-03 12:30:07 +01:00
Kornel Benko
e6418431dd Findadv: Handle the problem with list environments
The problem was, that the different list ennvironments
did not look different in tha latex output used for
search.
So the input of "\item ..." did not give information
if it is description, lyxlist, enumeration or labeling.

In search modus we use now "\item{enumeration}" etc.
2018-11-03 11:15:12 +01:00
Kornel Benko
5c83ad37d0 Findadv: Use '\n' as delimiter for end of data with same features
This allows to use '.' in regex without matching also wrong data.

Also added modified patch from ajd (see #11241).
2018-11-02 10:32:28 +01:00
Kornel Benko
47455ad65e Added test findadv-22
Related to https://www.lyx.org/trac/ticket/11241
(Find and replace doesn't find a wedge of two things in a subscript.)
2018-10-31 11:19:47 +01:00
Kornel Benko
5af8ec3240 Findadv: Allow multiple math statements in a line 2018-10-30 20:54:32 +01:00
Juergen Spitzmueller
b8932afed5 Dispay pre- and posttext widgets if non-empty also if unapplied
Fixes: #11352
2018-10-30 17:23:08 +01:00
Juergen Spitzmueller
0ec295d63e Fix parentheses with Hebrew
Patch by Guy Rutenberg, with some changes of mine.

Fixes: #11191
2018-10-30 12:33:35 +01:00
Kornel Benko
f0d7432608 Findadv: Remaining findadv tests pass now
Exception: findadv-21, but it is not a regression,
because this one never passed.
The problem here is, that we cannot differentiate
between enumeration, itemize, description and labeling
environment here.
2018-10-29 13:17:54 +01:00
Kornel Benko
aecd98dc46 Findadv: Adapt search for special chars '[', ']', '%' and '#' 2018-10-29 07:37:32 +01:00
Kornel Benko
2d477c5e0a Changes to match math equations
Now tests findadv-01 ... findadv-20 pass too.

keytest.py: Expanded time for controll keys (like \[Return])
findadv*: expanded time for normal keys
lyxfind.cpp: Handle math equations
2018-10-28 19:40:14 +01:00
Scott Kostyshak
645d42f451 Revert "Comment out unused functions to restore -Werror"
This reverts commit bceb2390b4.

For details, see:

https://www.mail-archive.com/search?l=mid&q=4724814.5HqUF52VLN%40amd64
2018-10-28 11:43:47 -04:00
Scott Kostyshak
bceb2390b4 Comment out unused functions to restore -Werror
This commit restores compilation with -Werror and g++ version 7.3.0.

Consistent with 6dc450bc.
2018-10-27 20:59:26 -04:00
Scott Kostyshak
e9384cb8d0 Amend 23041f53: remove extra parenthesis 2018-10-27 19:16:36 -04:00
Kornel Benko
23041f53ea Amend 4459603, MSVC versions >= 1915 allow std::regex 2018-10-27 20:51:57 +02:00
Kornel Benko
0f72179a07 Amend(4) 74c849d Advanced search with format
Prepare for use with func request. For instance to
ignore language while searching:
	setIgnoreFormat("language", true);
2018-10-27 16:57:42 +02:00
Stephan Witt
d470477ab0 Add dummy implementation for Messages::getIfFound (used when ENABLE_NLS is false) 2018-10-27 16:12:02 +02:00
Kornel Benko
4459603b61 Allow std::regex for MSVC10 2018-10-25 10:14:49 +02:00
Kornel Benko
0b3f644469 Amend(3) 74c849d Advanced search with format
* Discard now unneeded code
* Remove macro '\uldepth=...'
2018-10-24 11:07:11 +02:00