Commit Graph

174 Commits

Author SHA1 Message Date
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Georg Baum
b596330093 Fix compilation with boost 1.58
Newer boost versions use complicated type traits for boost::next and
boost::prior, which do not work with the RandomAccessList iterators.
The long term solution is to use std::next and std::prev, for now supply
simple replacements for compilers that do not support C++11 yet.
2015-05-16 00:05:23 +02:00
Scott Kostyshak
66f527e417 Update previews after doing a find/replace (#7242)
This commit addresses #7242 for normal Find/Replace. That issue was
fixed for Advanced Find at 29948eec.
2015-04-18 21:47:21 -04:00
Alfredo Braunstein
8f821dba70 Rewrite of change-related helpers
lyxfind.cpp(findNextChange, findPreviousChange, findChange, selectChange): factor the change-selection part out of the change-finding part
Text.cpp (acceptOrRejectChanges): call only selectChange
2014-10-14 17:40:44 +02:00
Jean-Marc Lasgouttes
7c3d1d7423 Fix crash when accepting change
The problem is the use of cursor movement methods to update cursor.
Cursor::forwardPos() steps into insets, which is not always what we
want. The problem here is that there is a math inset just after the
accepted change, and that the cursor steps into it for some reason.

This code is a nightmare anyway.

Fixes: bug #9145
2014-06-05 12:23:19 +02:00
Tommaso Cucinotta
cb79658e54 Workaround for #7987: deleted text in change-tracking mode is not found in Advanced F&R any more. 2014-04-21 11:51:59 -04:00
Tommaso Cucinotta
13cb7da11d Merged Paragraph::stringify into asString(). 2014-04-21 11:51:59 -04:00
Juergen Spitzmueller
ad6f96bf48 Do not substract cursors pos from two different cells (fix assertion while doing adv search)
Fixes: #7944.
2014-04-21 11:51:59 -04:00
Richard Heck
0a6ff99f28 Typos and style. 2014-04-21 11:51:59 -04:00
Vincent van Ravesteijn
53b60462ac Revert "Fixing #7987: deleted text in change-tracking mode is not found in Advanced F&R any more."
This reverts commit cb351665f4.
2014-03-29 22:21:40 +01:00
Tommaso Cucinotta
cb351665f4 Fixing #7987: deleted text in change-tracking mode is not found in Advanced F&R any more.
Merged Paragraph::stringify into asString().
Added ignore of deleted text to Advanced F&R.
2014-03-27 23:36:15 +00:00
Jean-Marc Lasgouttes
c98ce56a03 Fix bug #8884: Crash when "navigate to next change"
The two fixes here a obviously right, although it is not clear why they are sufficient to fix the bug. Anyway I cannot reproduce any crash with it.

 * the first part just conditions a whole if/else to change_next_pos.changed(). Originally, only the if branch was concerned.

 * the second part is to avoid calling CursorSlice::backwardPos() when position is 0. Doing this leads to an assertion.
2014-03-03 11:16:56 +01:00
Scott Kostyshak
f52eb9d823 Comment a minor bug not worth fixing (#8986) 2014-02-19 16:21:46 -05:00
Tommaso Cucinotta
b93f2c20d3 Added restrict-search-to-maths-only checkbox to advanced pane of Advanced F&R. 2013-10-13 00:59:46 +01:00
Tommaso Cucinotta
7081fed380 Fixed a number of bugs in "preserve first case" feature of Advanced F&R (addressing #8383). 2013-07-22 10:39:11 +01:00
Pavel Sanda
4c0ef38200 Header cleanup cont. 2013-05-19 18:07:53 -07:00
Jean-Marc Lasgouttes
249d96ed94 Small clanup (just move functions around) 2013-05-06 22:50:26 +02:00
Jean-Marc Lasgouttes
68202fdf44 Fix bug 6055: change-next does not work in tables
The problem was just the faulty use of CursorSlice::at_begin/end(), which does not look for end of cell, but end of inset.
2013-05-06 12:29:27 +02:00
Richard Heck
d79225ae98 Remove all messages to user related to assertions. We'll just use
a basic message which is defined in lassert.cpp now.
2013-04-27 17:52:55 -04:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Jean-Marc Lasgouttes
77bf805155 Fix bug #3199: change-next may leave empty lines behind
Using Cursor::setCursor or even BufferView::setCursor is often a bad
idea since it does not run DEPM. In this case (and other cases in
f&replace code) it is better to use BufferView::mouseSetCursor (which
should maybe be renamed...).
2013-04-25 15:37:15 +02:00
Jean-Marc Lasgouttes
a88e5cbf74 Fix bug #8370: crash when searching for next change
Cursor::backwardPos() may enter in a nested inset, while CursorSlice::backwardPos() will not.
2013-04-07 14:22:37 +02:00
Tommaso Cucinotta
6ea1479252 Just refactoring patch 5e5115c3 in simpler terms. 2013-04-04 00:50:02 +01:00
Tommaso Cucinotta
5e5115c376 Fixed issue #8543 also for advanced search (cursor moved at proper end of selection before starting Find Advanced operation). 2013-04-04 00:43:36 +01:00
Scott Kostyshak
2427e9b57a Remove exclamation mark from "String not found!"
When using 'find' and a string is not found, this is not an error or a
surprising event. It is often expected (e.g. after searching through
the whole document for a certain string eventually you will get this
message). The exclamation mark should be reserved for messages that
are unexpected or that need extra attention, such as errors.
2013-04-01 15:33:41 -04:00
Kornel Benko
415343d19b Advanced search: Allow faster searching for normal (non-regular) strings
Setting variable 'par_as_string_nolead' also in case we are ignoring format,
drastically accelerates the search.
2013-04-01 10:16:45 +02:00
Jean-Marc Lasgouttes
0082d183b3 Fix confusing behavior in search when changing directions (bug 8543) 2013-02-22 15:53:40 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Lars Gullik Bjønnes
43f6b1672b Use empty() to check empty and non-empty'ness not size()
Also add FormatList::empty().
2012-10-27 01:25:38 +02:00
Lars Gullik Bjønnes
abc81db388 src/lyxfind.cpp: use local typedef to simplify
Use a local typedef pair<string, string> P to avoid having to repeat
that multiple times.
2012-10-23 23:48:35 +02:00
Lars Gullik Bjønnes
48bba7fb74 src/lyxfind.cpp: use make_pair
Use make_pair(...) instead of pair<T, U>(...).
2012-10-23 23:48:25 +02:00
Lars Gullik Bjønnes
cf193344d0 src/lyxfind.cpp: cleanup formatting
Remove some eol space
re-indent where required
make some ?: constructs a bit easier to read.
2012-10-23 23:48:25 +02:00
Tommaso Cucinotta
0e81930597 Fixed bug in escape sequence, showing up with ignore format off (addressing #8380). 2012-10-22 01:05:29 +01:00
Stephan Witt
430cf3ee5e Fix the wrong cursor move when forward flag is false:
The forward flag is used to place the cursor behind the replaced text if it's true.
But it's not correct to move the cursor if it's false. The cursor is in front of the
replacement already after the replaceSelectionWithString() was done.
2012-07-30 14:32:29 +02:00
Jean-Marc Lasgouttes
a117a51226 In replaceSelectionWithString, do not select the new string
This is a patch from Scott Kostyshak. The problem it solves is as follows:

1. enable continuous spell check.
2. type a misspelled word and press space so that it has a wavy red underline.
3. right-click and choose a suggested replacement word.
4. press the backspace button.

Result: nothing happens. If you press the backspace button again, then it works as normal.

The selection code was added for the benefit of the spellchecker, but the code has been rewritten since then.
2012-04-18 12:44:31 +02:00
Tommaso Cucinotta
c324d6eae6 Now ESC cancels long Advanced Find and Replace operations.
(see #7217 and #7965 for related issues and discussion)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40877 a592a061-630c-0410-9148-cb99ea01b6c8
2012-03-06 23:21:12 +00:00
Georg Baum
a74153da0b cur.inTexted() != !cur.inMathed()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39883 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-18 18:57:42 +00:00
Tommaso Cucinotta
ab73c741c2 With the move from \regexp{...} to \regexp{...\endregexp{}}, now I'd need
a special method to find \endregexp{}}, not merely the closing brace.
This is now obsolete, so ok to remove this dead code.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39780 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-27 23:09:31 +00:00
Richard Heck
144a69f4eb Comment out unused function.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39740 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-23 17:52:20 +00:00
Tommaso Cucinotta
ef7a142f3f Fixed longstanding bug in Advanced Find&Replace, when dealing with documents containing braces.
Corresponding test-case needed a fix as well and now it is passed.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39518 a592a061-630c-0410-9148-cb99ea01b6c8
2011-08-25 19:16:14 +00:00
Tommaso Cucinotta
bc9e5607fb After replacing with multi-cell contents, now advanced find and replace leaves the cursor after the inserted material.
Addressing http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg169981.html



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39266 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-10 00:19:11 +00:00
Tommaso Cucinotta
a48baee56f Now Adv. F&R correctly interprets escape sequences within regexp insets, e.g., \\ or \(, for finding characters with a special meaning in regular expression context (\^()[]).
Added corresponding regression tests findadv-re-01 and -02 for finding these special characters.
Unfortunately, braces {} are a little bit special and don't work yet. Added findadv-re-03 regression test to not forget about this case.
This goes along the line of fixing issues reported by Andrew Parsloe and summarised as #7638.
Last note: Still there will be cases when the Advanced F&R won't work, especially if the text to be found and/or the search pattern is preceded by backslashes or others.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39135 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-19 16:41:23 +00:00
Tommaso Cucinotta
c7e609135a Now backslash-prefixed regexps like "\s", "\d", etc., are all understood by Advanced F&R.
Fixing issue 4 reported at: http://permalink.gmane.org/gmane.editors.lyx.devel/136992


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39016 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-12 00:12:26 +00:00
Tommaso Cucinotta
69ab1306a8 Avoid extra ' ' in text-only export of consecutive macros in math mode, for Advanced F&R matching, with ignore-format off.
For example, this wasn't allowing to match '\beta\alpha' in the sequence '\alpha\beta\alpha', as
in the accompanying regression test-case (added case for ignore-format off).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38888 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-29 14:08:29 +00:00
Tommaso Cucinotta
2d8108cf4c Avoid extra ' ' in text-only export of consecutive macros in math mode, for Advanced F&R matching.
For example, this wasn't allowing to match '\beta\alpha' in the sequence '\alpha\beta\alpha', as
in the accompanying regression test-case.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38883 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-29 13:40:34 +00:00
Tommaso Cucinotta
ec46b98d8c Fixed bug in matching at borders within *-environments with ignore-format off.
(related to #7596)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38863 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-27 21:14:36 +00:00
Tommaso Cucinotta
386c8291ed Fixed Advanced F&R issue in matching things at environment borders with ignore-format off.
Added accompanying regression tests for displayed math and numbered equations.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38860 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-27 20:39:58 +00:00
Tommaso Cucinotta
f1965e9ff1 Bugfix in how the search buffer was exported for the Advanced Find & Replace.
For example, before this footnotes were not correctly found.
Added also accompanying regression test.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38846 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-26 17:08:48 +00:00
Tommaso Cucinotta
c92c9057e1 Now advanced find and replace doesn't ignore white spaces while matching with ignore format.
This fixes #7584.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38839 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-26 13:44:44 +00:00
Vincent van Ravesteijn
a522dd5035 Whitespace: correct whitespace after r38779 and r38789.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38799 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-21 10:44:27 +00:00