[Cuis-dev] Fwd: Undoing after Saving

Santiago Dandois santids97 at gmail.com
Sun Oct 27 10:53:55 PDT 2019


Hi,

I've been using Cuis for a while, and there's something that felt
bothersome to me: you cannot do Ctrl-z to undo changes after saving a
method. Then I thought I could fix it myself.

After doing some research, this is what I found about what is happening:

When you do (C-S) to save a text, then the message #acceptContents is sent
to
the InnerTextMorph.

The method for this messages, calls `model refetch`, being model a
PlugglableTextModel. Then, the method for this message calls,
`self actualConents: (textProvider perform: textGetter).` (Sort of).

And finally, in the TextModel actualContents: implementation,
the undoRedoCommands is being reset.

I found out two possible solutions to this issue (Changes attached).

The first one I called it "The Safe One". In this solution, I modify the
actualContents: method to check if the nextActualContets received as a
parameter is equal to the actualContents before the message was sent. If
so, I just keep the undoRedoCommands as they are.

Then I thought that since the text actually didn't change ,there may not be
any need to do the refetching. This seems to be working also, but I since I
cannot understand why there was a refetch in the first place, I fear I'am
missing something. Moreover, there is a comment warning about this.

I hope you found this contribution helpful.

Cheers,
   Santiago José Dandois
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191027/1f9dde19/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3842-UndoAfterSaveUnsafe-SantiagoJoseDandois-2019Oct27.cs.st
Type: application/octet-stream
Size: 694 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191027/1f9dde19/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3841-UndoAfterSaveSafeOne-SantiagoJoseDandois-2019Oct27.cs.st
Type: application/octet-stream
Size: 767 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191027/1f9dde19/attachment-0001.obj>


More information about the Cuis-dev mailing list