Commit Graph

185 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
6ec1683aee Fix crash introduced in my previous commit f6b1c24b
Cursor::fixIfBroken does not do what I thought it did. Lift some code
from StableDocIterator::asDocIterator instead.
2012-07-17 22:26:44 +02:00
Jean-Marc Lasgouttes
f6b1c24b99 Fix bug #5204: Undo removes text selection
This commit does a bit more than fix selection, since it saves the full cursor state
in the undo stack. This means that undo now restores:
* the selection
* the current font
* transient mark (shall we keep this one?), logical position...

In order to do that, it introduces an intermediate class between Cursor and DotIterator: CursorData.
The new inheritance diagram is thus
  DocIteraator -> CursorData -> Cursor

CursorData contains all the members of Cursor that define the current position, but not the stuff
related to current view of dispatch mechanism. It may make sense in the future to move members
between CursorData and Cursor and to move some member functions to CursorData.

Now UndoElement uses CursorData for cur_before and cur_after, but not for the cell. The undo API uses
also CursorData instead of DocIterator.
2012-07-15 18:16:09 +02:00
Jean-Marc Lasgouttes
ec3aed75ad Fix bug #6367: Screen jumps around when using undo/redo
http://www.lyx.org/trac/ticket/6367

* Undo.cpp: 
 - rename cur member of UndoElement to cur_before
 - add new member cur_after, which is set by Undo::endUndoGroup
 - create a new Undo::endUndoGroup variant that takes a Cursor as parameter. We cannot get rid of the old one because it is used for LFUN_COMMAND_SEQUENCE.
* Cursor.cpp: 
 - use endUndoGroup(Dociterator const &) for dispatch
 - update Cursor::endUndoGroup to pass cursor.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40713 a592a061-630c-0410-9148-cb99ea01b6c8
2012-02-07 14:56:16 +00:00
Richard Heck
210a440609 Attempt to fix #7673 in a more "interesting" way than in branch (where
we will be cautious, of course). The problem was that we were issuing
the Buffer::changed() signal before we did updateBuffer(), and this
caused an inconsistency. The idea here is to defer issuing this signal
until we call processUpdateFlags(). We know we need a redraw if we've
deleted a whole paragraph.

This should work properly, so long as checkDepm is called from within
the dispatch mechanism. There may, however, be other paths, and I've
noted one explicitly with a FIXME in Text2.cpp. I've tested a few
different variations, however, and I haven't seen any problems. But if
we do run into problems, we can go ahead and do the update there that we
were previously doing in checkDepm itself.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40352 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-03 22:42:09 +00:00
Stephan Witt
934cadd381 improve the method naming for "mark new word position", move the mark operation out of bookmarkEditPosition up one level to LFUN_SELF_INSERT of the text inset dispatch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38181 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-01 05:49:04 +00:00
Vincent van Ravesteijn
4fcbb93e39 Do not give access to the actual data of the CoordCache. This prevents the use of the stored pointers which might be invalid.
See also r38011.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38012 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-23 17:43:13 +00:00
Stephan Witt
5866504aba #7350 more checks to validate the DocIterator before calling locateWord() in checkNewWordPosition()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37931 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-15 10:27:41 +00:00
Stephan Witt
6118beae8d better fix for regression introduced by r37463: crash when dissolving an inset. then the saved cursor slices of new_word_ are out of sync, add a check for count of nested insets
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37899 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-10 20:15:34 +00:00
Enrico Forestieri
624f725acb Fix bug #7316 (Crash editing commands in math mode)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37750 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-21 15:26:28 +00:00
Stephan Witt
e1a685fcb1 fix a crash when the inset containing the new word at cursor is deleted
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37563 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-08 09:42:00 +00:00
Stephan Witt
f361c26a05 suppress the misspelled marker only when typing in a word the first time
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37463 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-03 17:27:13 +00:00
Tommaso Cucinotta
e70a79fc0b Code simplification (thx Vincent).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37341 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-28 09:52:12 +00:00
Tommaso Cucinotta
917785df71 Completing r37335 (apologies).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37336 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-27 00:43:25 +00:00
Stephan Witt
0e5369dcda #7209 avoid a crash in inMacroMode(): one cannot get the previous atom of an empty math cell
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37162 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-10 10:23:10 +00:00
Vincent van Ravesteijn
6eea764ead Cursor: constify.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37160 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-10 09:38:20 +00:00
Georg Baum
006a906858 forgot to declare debugToken() in r37117
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37133 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-06 18:36:03 +00:00
Stephan Witt
ab9de435b4 fix typo: double semicolon at line end of code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36985 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-21 15:28:55 +00:00
Abdelrazak Younes
ae7bcd3312 GuiView::dispatchToBufferView(): simplify code and move some to Cursor::dispatch().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36733 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-05 00:57:04 +00:00
Jean-Marc Lasgouttes
574931dcdb Fix bug #6930: no undo for inset type changing
THis is a consequence of the new AtPoint mechanism. In the old
world, recordUndoInset was called before INSET_MODIFY. I reintroduced
manual recordUndoInset calls in all places that matter. I suspect
that this issue should be revisited later.

Note that recordUndoInset can now take an optional parameter that tells
what inset is concerned. This is useful because the cursor can be
either just inside the inset or in front of it.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36580 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-29 09:47:46 +00:00
Enrico Forestieri
1f6370dfd7 Fix bug #6939 (Using math-insert to input math macros overwrites math expressions)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36216 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-09 00:03:32 +00:00
Jean-Marc Lasgouttes
b9b619641b This patch implements proper ERT behaviour for normal layouts.
In particular, it makes paragraph breaks generate single \n in latex output
when ParbreakIsNewline is true

This means that it is not necessary anymore to use newlines to break lines. 
Plain paragraph breaks can be used instead, like is done now in ERT/Listings. 
This is mainly aimed at sweave support.

lyx2lyx support courtesy of Richard Heck



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36163 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-06 15:06:19 +00:00
Vincent van Ravesteijn
07924ac300 Remove some unnecessary static_casts and add two FIXMEs about casts that don't look safe.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35856 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-26 16:45:21 +00:00
Peter Kümmel
496f7a23fd Fix bug 6650: Error Messages Repeated
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35664 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-17 12:06:47 +00:00
Richard Heck
6a80ce62ca DispatchResult::update() ==> DispatchResult::screenUpdate()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35631 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 17:28:55 +00:00
Stephan Witt
dec437fbac add cache of spell checker results to speed up native speller engine on macosx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35362 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-14 05:24:04 +00:00
Jean-Marc Lasgouttes
b221b0e1fd Fix bug #6736: 2.0.0 alpha 3, spell check on the fly bug
This bug is related to the fact that the cusor remember the current font.

The on-the-fly spell status should really not be kept in the Font object, but
rather in metrics, IMO.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35041 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-02 21:20:59 +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
Richard Heck
0e14f379f3 Rename a couple routines. This will avoid confusion with a forthcoming
patch.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34816 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-08 20:04:35 +00:00
Peter Kümmel
21514ad512 Seems boost also includes all std headers. Not including boost therefore produces errors.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34260 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-22 11:45:34 +00:00
Peter Kümmel
61b2bd5e7f Using "using namespace std" with msvc10 makes also std::tr1::bind visible and generates conflicts with boost::bind.
Solution: don't use boost::bind for msvc10 (could also be extended  to several GCC versions)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34257 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-22 11:16:58 +00:00
Vincent van Ravesteijn
63d24ca3c4 Remove boundary parameter from BufferView::getPos(). The first DocIterator parameter already contains this information.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34247 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 13:03:04 +00:00
Vincent van Ravesteijn
108a67ed43 Make Cursor::anchor_ private and make an access function Cursor::realAnchor() to stress the fact that this is thus not the normalAnchor().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34146 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-15 18:16:07 +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
Vincent van Ravesteijn
ebb830ba9b Do not change the object that is returned by result(), this will have no effect because result() returned a copy. From now, it just returns a const & to prevent this from happening again.
see r31969.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34143 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-15 17:14:59 +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
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
Richard Heck
a932148ce4 Remove unneeded include.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33392 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-09 16:31:09 +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
Jean-Marc Lasgouttes
ead206efb0 remove last member variables from LyXFunc and move them to cursor. Now the class can be replaced by a namespace
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33386 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-09 14:29:27 +00:00
Jean-Marc Lasgouttes
a1e991a82e Get rid of the errorstat and dispatch_buffer members of LyXFunc.
This required to make Cursor::disp_ mutable.

Also, the server parts now pass a DispatchResult object to dispatch (which is
a good thing anyway).



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33259 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-29 11:22:33 +00:00
Jürgen Spitzmüller
7bbd67eb26 * Implement updateLabels in mathed and add the MathRef insets to the references cache.
This fixes bug #1560.

The diverse setBuffer / updateLabels calls need auditing. See FIXMEs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33249 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-28 17:37:22 +00:00
Jean-Marc Lasgouttes
943a39b1e2 always close properly undo groups
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33129 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-21 16:59:39 +00:00
Vincent van Ravesteijn
b9d5184979 Fix bug #6448: Crash with invalid anchor.
If we check whether a cursor is valid, we should also check the anchor_.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33012 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-13 18:57:42 +00:00
Vincent van Ravesteijn
742ee134a4 Make setCursorToAnchor set the cursor to the normalized selection anchor in stead of the real anchor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32790 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-06 16:59:12 +00:00
Vincent van Ravesteijn
b3128dc63b Fix second part of bug #6400: After selecting a word by double-clicking it, extending the selection by a single mouse-click should also select only whole words.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32580 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-18 14:18:10 +00:00
Enrico Forestieri
9e423f23fa Spare a few cpu cycles on average.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32474 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-11 01:46:57 +00:00
Enrico Forestieri
c2befc2b1e Fix bug #6382: Wrong cursor placement when inserting math
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32473 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-11 01:30:33 +00:00
Enrico Forestieri
38a6848ecd Fix bug #6342: Pasting-bug in math-mode sub- and super-scripts
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32162 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-23 00:59:18 +00:00
Vincent van Ravesteijn
92c8561674 Some cosmetics after r32157.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32159 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-22 21:45:51 +00:00