Commit Graph

140 Commits

Author SHA1 Message Date
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
Richard Heck
ddc585317c Revert r38779. I guess even the most innocent seeming of these will need more work.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38789 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-19 11:56:36 +00:00
Stephan Witt
56960daa7c #7564 add new argument to the documentation of LFUN_WORD_REPLACE, make the default of the new argument backward compatible
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38785 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-19 05:50:55 +00:00
Stephan Witt
cec318896c #7564 make the move forward to next match after text replacement optional and suppress it when replace a word by selected suggestion
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38781 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-18 20:33:57 +00:00
Richard Heck
17af57ed0c This should not need doing, as we are called from
BufferView::dispatch(), and the screen update is done properly there.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38779 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-17 01:58:52 +00:00
Richard Heck
5db4b7eb16 Move a bunch of code from Buffer to BufferParams. The point of this
is contained in the next commit.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38742 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-13 19:39:56 +00:00
Tommaso Cucinotta
8fd08e4ece Nearly cosmetics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38410 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-16 10:48:55 +00:00
Tommaso Cucinotta
29948eec26 Now math previews are correctly updated when replacing math contents inside
through Advanced Find and Replace.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38355 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-12 20:16:57 +00:00
Tommaso Cucinotta
62411b7c0f Fixes a weird bug found while playing with #7363.
Indeed, unchecking ignore format in that scenario was not matching anyway while searching.
This patch fixes that behavior.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37943 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-18 00:47:42 +00:00
Enrico Forestieri
d866717ef7 Integrate texrow with otexstream in order to perform automatic line
counting when exporting to latex. This is done for the code comprised
between \begin{document} and \end{document}, while the preamble code
still needs manual calls to TexRow::newline() for registering new lines.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37584 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-10 20:02:48 +00:00
Tommaso Cucinotta
dc4abad361 Removing dependency on longOperationCancelled() patch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37562 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-08 09:11:58 +00:00
Tommaso Cucinotta
fcae022192 Search and replace buffers are now passed from the GUI to the Model
just by their file-name, and directly accessed there.
All string/latex exporting of those buffers is handled on the Model
side (lyxfind.cpp) according to the selected options.
Fixed bugs when searching with ignore-format disabled material
in the middle of a paragraph, and when using regular expressions.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37549 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-07 20:36:40 +00:00
Enrico Forestieri
1ef605f625 Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
Tommaso Cucinotta
e05d115be8 Fixing regression bug after last commit. Couldn't find anything better, however now it apparently works and doesn't crash
(when replacing text which is longer than the replaced contents in math mode and similar).



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37335 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-26 23:54:12 +00:00
Tommaso Cucinotta
c005af6749 Puts the selection at the correct position after replacing math contents with Advanced Search.
Fixes crashes reported as #7245 and also #7241.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37333 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-26 23:06:02 +00:00
Tommaso Cucinotta
22d245312a Addressing #6560.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37048 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-30 17:59:59 +00:00
Tommaso Cucinotta
fa0e638b95 Fix of #4388 also for non advanced find.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37047 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-30 15:34:09 +00:00
Tommaso Cucinotta
fab8c264aa Applying (variation of) fix by stwitt to solve #7172.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37043 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-29 19:59:41 +00:00
Abdelrazak Younes
1614a64e15 TeXOnePar() simplification: use pit_type instead of iterator
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36936 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 15:57:27 +00:00
Jean-Marc Lasgouttes
3370b1d2fa Fix the last part of #3733:
- In GuiApplication::dispatch, do not call markDirty() for lfuns that are not ReadOnly
- In Undo::Private::recordUndo, call markDirty(). The indicator of dirtyness is now the existence of an undo element.
- In lyxfind, remove several markDirty calls that are not needed anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36772 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-08 10:30:45 +00:00
Tommaso Cucinotta
5e5122699d Ignore ligature breaks and hyphenations during simple search (fixes #1468).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36427 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-22 07:50:34 +00:00
Uwe Stöhr
ce2ca9bd7e lyxfind.cpp: squash compiler warnings
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36414 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-20 18:28:28 +00:00
Tommaso Cucinotta
630953e613 Finds formatted matches in the middle of paragraphs, when no regular expressions are involved (fixes #6891).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36411 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-20 15:57:54 +00:00
Tommaso Cucinotta
df8e614237 Fix update of document buffer on last replace operation.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36405 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-20 11:04:40 +00:00
Tommaso Cucinotta
55641a1a74 Some more debugging stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36404 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-20 11:03:24 +00:00
Pavel Sanda
058c815515 Fix order of return value
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36299 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-14 23:23:20 +00:00
Richard Heck
97b82d285d Fix up some of the find and replace code again. This solves a bug
involving the messages and will also help sort out some dispatch stuff.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35649 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-14 14:32:58 +00:00
Pavel Sanda
0978e91ecf This stuff is general enough for lstrings
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35646 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-14 11:01:15 +00:00
Richard Heck
3fe55bccc4 const
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35642 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:59:24 +00:00
Richard Heck
e9cf7aabcb Const.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35640 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:57:57 +00:00
Richard Heck
d3e4bfb124 Change how some of the updating stuff is handled in lyxfind. I had no
idea what a mess this was.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35639 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:53:41 +00:00
Richard Heck
3b00f19cc2 Anonymize some things.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35638 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:30:37 +00:00
Richard Heck
9511e345c1 Why have an argument in an anonymous method if you aren't going to use
it?


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35637 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:27:40 +00:00
Richard Heck
77a9dfcdba More find cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35636 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:24:53 +00:00
Richard Heck
b261a6d247 Begin some cleanup of the find code. I'm trying to sort out some odd
dispatch behavior, but can't understand this code as it is. Why isn't
there any documenation here?


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35635 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 18:19:21 +00:00