Review Request: Maintain text selection through undo/redo

C. Boemann cbr at boemann.dk
Mon Feb 27 17:44:52 GMT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104098/#review10955
-----------------------------------------------------------


on closer thought i don't think we can ever get this right. The problem is that we don't have access to the position before first. When the command is created the cursor has alredy been moved.

neverthenless i'l mention that redo shold not restore the original position but the position before undo. (because of the above probelm this is actually correct in your code but hardly intentional)

- C. Boemann


On Feb. 27, 2012, 5:03 p.m., Elvis Stansvik wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104098/
> -----------------------------------------------------------
> 
> (Updated Feb. 27, 2012, 5:03 p.m.)
> 
> 
> Review request for Calligra, Pierre Stirnweiss and C. Boemann.
> 
> 
> Description
> -------
> 
> An unfortunate effect of calling QTextDocument::undo/redo is that it will move the cursor to where the change happened, but not the selection (anchor).
> 
> This patch makes sure that on construction of a UndoTextCommand, the current cursor and anchor positions are saved. They are then restored after the calls to QTextDocument::undo/redo. The effect is the same behavior as in LO Writer.
> 
> 
> Diffs
> -----
> 
>   libs/kotext/KoTextEditor_undo.cpp 912540b 
> 
> Diff: http://git.reviewboard.kde.org/r/104098/diff/
> 
> 
> Testing
> -------
> 
> Tested repeatedly making different words bold, then undoing and redoing the operations. The selection is maintained.
> 
> 
> Thanks,
> 
> Elvis Stansvik
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20120227/b07f18ed/attachment.htm>


More information about the calligra-devel mailing list