The functions reverseDirectionNeeded() and reverseDirectionNeeded() do
not rely on the Bidi class. The first one is changed into a Cursor
method, and the second one is replaced with explicit code.
* Remove the UndoKind parameter in the general interface
* move recordUndoInset to Cursor
* remove one variant of Undo::recordUndo.
* get rid of Text::recUndo.
Additionally, move the code to write to a stream from Cursor to CursorData (so that debugging undo is easier). We loose x_target, but I am not sure it is important.
This is the second part of bug #9432.
Rename recordUndoFullDocument to recordUndoFullBuffer.
Separate the notion of recording changes to paragraphs and recording changes in buffer parameters.
Audit every user of recordUndoFullDocument and replace it with either recordUndoBufferParams or recordUndoFullBuffer. Add comments to identify remaining work.
False positive rate of hints is quite high. Although the includes can be
technically removed (due to other includes) they logically belong to the
header.
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.
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
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
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
here ran into insufferable problems: I.e., a Cursor IS-A DocIterator in
the code now, whether it was before or not.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34646 a592a061-630c-0410-9148-cb99ea01b6c8
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
Move the AtPoint handling into the Cursor dispatch machinery
Note that the call to Cursor::getStatus is in BufferView::getStatus, while
the call to Cursor::dispatch is still in LyXFunc::dispatch. This needs to be
fixed, but the code there is a bit fragile.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31969 a592a061-630c-0410-9148-cb99ea01b6c8
Make sure we jump to the next or previous change when we switch search direction. Without this patch, the same Change will be found and only the cursor is moved from the end (or begin) to the begin (or end) of the selection.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29115 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=5173
* Undo.cpp (beginUndoGroup, endUndoGroup): new methods.
(UndoElement): add group_id member
(UndoElementStack): when removing old undo entries, make sure to
remove whole groups.
(Undo::Private): add group_id and group_level (for nesting) members.
(doTextUndoOrRedo): new method. Apply _one_ UndoElement.
(textUndoOrRedo): call doTextUndoOrRedo on each element of the current
group.
(recordUndoFullDocument): put inside an undo group
* Cursor.cpp (beginUndoGroup, endUndoGroup): new methods.
* LyXFunc.cpp (dispatch): add calls to (begin|end)UndoGroup.
* lyxfind.cpp (replaceAll): use several recordUndo instead
of one recordUndoFullDocument.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26178 a592a061-630c-0410-9148-cb99ea01b6c8
Specifically, moved the functions which actually move left or right from Text
into Cursor, and changed the semantics so that they now return whether or not
the cursor has moved. The functions in Text now use the new functions in Cursor.
This change is being made in preparation of the Word-level visual movement.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24601 a592a061-630c-0410-9148-cb99ea01b6c8