Review Request: Maintain text selection through undo/redo

Elvis Stansvik elvstone at gmail.com
Wed Feb 29 22:45:14 GMT 2012



> On Feb. 27, 2012, 5:44 p.m., C. Boemann wrote:
> > 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)

Okay. I'll actually close the review for now since (as always) school work has come in the way. But you're right in that this needs more thinking. So hopefully we can come up with a proper solution in the future. It's not a release blocker after all.


- Elvis


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


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/20120229/94617c27/attachment.htm>


More information about the calligra-devel mailing list