Commit Graph

113 Commits

Author SHA1 Message Date
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
Richard Heck
5577e877bb Try to move all updateBuffer() calls to a central location. We now use
DispatchResult to store a flag that tells us whether we need a buffer
update or not. 

So: If you find a missing one, go to an appropriate place in the
dispatch and call cur.forceBufferUpdate() or, if you don't have a cursor
but do have a DispatchResult, call dr.forceBufferUpdate().

There is one remaining call I could not move, in
TextMetrics::redoParagraph. But this looks like an emergency call when
the macro context has not been set. There are also a couple calls that
are connected with buffer creation that I commented out, since the same
call is done again almost immediately. But I'm not positive about those.

Now the nice thing would be to do the same for updateMacros().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34826 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-09 14:37:00 +00:00
Peter Kümmel
615d42d357 TR1: use std::tr1 regex with msvc10
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34725 a592a061-630c-0410-9148-cb99ea01b6c8
2010-06-29 17:09:40 +00:00
Vincent van Ravesteijn
d9fab1ecc6 * lyxfind: Remove unnecessary non-const reference as parameter.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34355 a592a061-630c-0410-9148-cb99ea01b6c8
2010-05-02 22:33:36 +00:00
Vincent van Ravesteijn
d8db0e8515 Rename anchor() to normalAnchor() as the anchor() function was already returning a normalized anchor in stead of the real one.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34145 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-15 17:49:15 +00:00
Richard Heck
b79d8e5e2d Make members of FuncRequest private, per the FIXME there. Again, this is
basically a massive renaming, with no real changes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34106 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-09 19:00:42 +00:00
Richard Heck
4c7a5d0024 This is just a giant renaming of member variables in FuncRequest,
preparatory to making them private.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34105 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-09 18:15:17 +00:00
Tommaso Cucinotta
4bac24026d Fixed #2674 (Find and replace should restore initial cursor position), occurring on replace all.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33818 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-21 10:36:59 +00:00
Tommaso Cucinotta
57aa866a1c Fixed issues in backward search in various corner cases (fixed #6482 and #6596).
Now, when scope includes multiple documents, the switch_buffer LFUN is only issues if buffer actually changes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33812 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-20 13:59:46 +00:00
Tommaso Cucinotta
83104beee3 Limit the search for the word at current cursor position only to the case in which cursor is in texted.
Fixes crash in #6573.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33811 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-20 12:15:05 +00:00
Richard Heck
d65020b293 s/updateLabels/updateBuffer/g, per a suggestion of Abdel's.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33613 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-03 22:13:45 +00:00
Tommaso Cucinotta
a7f63005f0 Fixed #6555 (crash when trying to replace starting from multi-par selection with end pos < beg pos).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33542 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-22 21:44:59 +00:00
Abdelrazak Younes
377cdd5f6c Transfer LyXfunc code to GuiApplication::dispatch() and getStatus(). Now
a lot of simplification is possible. Except some instability period...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33389 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-09 16:11:13 +00:00
Tommaso Cucinotta
c0c1e1fd2b Most common cases with regexps seem to work, at least with ignore-format on.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33355 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-07 21:44:31 +00:00
Tommaso Cucinotta
b8af0d1cfd Fixed crash on searching for empty list inside empty list with ignore-format off (bug #6500).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33318 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-02 20:36:12 +00:00
Vincent van Ravesteijn
b7ff36304d Use Change::isSimilarTo to find a change when merging changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33284 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-31 00:21:52 +00:00
Tommaso Cucinotta
c0d42b97ee Made replace behaviour more standard: when pressing replace (next or previous) button:
-) if a selection exists, and it matches, then it is replaced;
-) next match is searched for and, if found, it is selected.
After a replace, next match is searched for only beyond the replaced text
(and not inside the replaced text).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33267 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-30 10:11:24 +00:00
Tommaso Cucinotta
52c059e68a Make the fake sequence for braces highly unlikely (addressing #6478).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33253 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-29 07:35:13 +00:00
Tommaso Cucinotta
c6784d708d Open or closed braces ({ or }) are now translated to non-braces fake constructs while searching (fixes #6478, avoiding assert).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33248 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-28 17:26:18 +00:00
Tommaso Cucinotta
ddebdc4514 Now the local text language is kept while replacing text (addressing #6171).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32961 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-11 02:20:51 +00:00
Vincent van Ravesteijn
43c8de8138 Cosmetics mainly: Rename math.h to cmath, reorder some includes, remove some includes and remove some superfluous "lyx::".
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32934 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-10 12:37:50 +00:00
Tommaso Cucinotta
fb4dfdf189 Implemented "whose words" option of the Advanced F&R feature.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32905 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-09 12:39:29 +00:00
Vincent van Ravesteijn
5079badb65 Fix bug #6428: Assertion when navigating to next change while in math mode.
We need to leave the math inset before trying to access cur.paragraph().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32791 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-06 17:29:39 +00:00
Vincent van Ravesteijn
b0910eb6d4 Why was there a 1 ? We only have to make sure that pos - 1 >= 0.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32772 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-05 16:34:52 +00:00
Tommaso Cucinotta
5cc2d6d73c Advanced F&R rework:
- scopes now handled in FindAndReplaceWidget, while lyxfind.cpp only searches within single buffer
- cursor().result().dispatched() now encodes whether a match was found or not, after LFUN_WORD_FINDADV dispatch
- removed a few unneeded functions
- followed a few cosmetic advices


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32760 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-04 12:29:38 +00:00
Tommaso Cucinotta
9e5a12b905 No need for the new LyXView::selectDocumentBuffer() method, same thing may be done with LFUN_SWITCH_BUFFER (vfr advice).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32739 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-01 11:14:01 +00:00
Tommaso Cucinotta
82e07a4185 Code cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32682 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-30 22:21:23 +00:00
Tommaso Cucinotta
24e2c495fe Implemented S_OPEN_BUFFERS scope in Advanced Find feature (keep searching and find all occurrences within all open buffers).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32680 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-30 21:50:55 +00:00