Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Feb 16, 2009 5:34 pm   

What is the status of the Undo feature in the Editor?
 
With more than 2 years passed after this thread
http://forums.zuggsoft.com/forums/viewtopic.php?t=25544

what is the current status of the Ctrl+Z (Undo) feature in the Editor? Unsupported, supported but not tested, available?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Feb 16, 2009 6:27 pm   
 
Ctrl-Z already works fine in the CMUD script editor. It doesn't just undo character by character like in the old thread that you posted a link to. It undoes whatever the last change was. The editor used in that old thread was completely different. CMUD uses the Scintilla editor component (used in NotePad++) for the script editor. And CMUD even supports multiple undos.

For example, create a new alias and enter the text:
Code:
this is a test
hello world

Now, double-click on the "test" word and press Ctrl-X to cut it and then press Ctrl-V to paste it. Now press Ctrl-Z to undo...the "test" text is removed. Press Ctrl-Z again and "test" will come back. Press Ctrl-Z again and all of the text will disappear.

So Ctrl-Z seems to be working fine. Now, I notice that Ctrl-Y isn't working properly to "redo" the edits, so I might look into that in the future.

It's not in the Edit menu because I'm worried that people would confuse it and think the "Undo" menu option would undo things like deleting a setting. It's really just an editor key function, like the new Find/Replace dialog, or the many other keyboard shortcuts that Scintilla editor provides. At some point I guess I should make a page in the help file showing the Scintilla editor shortcut keys.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Feb 16, 2009 7:31 pm   
 
Then there is a serious bug! Ctrl+Z can undo edit across multiple settings as long as it have undo entries in it's buffer, overwriting ALL settings with the same contents. Unfortunately, CMUD saves changes immediately with no chances to restore data. That's the way I lost 500-lines Lua code yesterday (please, please add *.pkg file backing up on package file opening, not closing or last save of it!). The procedure will follow; I didn't post it because I was not aware of the current status for the Undo feature.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Feb 16, 2009 7:44 pm   
 
The problem is that CMUD doesn't track to which setting it can apply current Undo.


Add this to the untitled session:
Code:

  <alias name="testAlias1" id="1">
    <value>#SAY "Another small alias."
#SAY "Another small alias."</value>
  </alias>
  <alias name="testAlias2" id="2">
    <value>#PRINT "A small alias."</value>
  </alias>
  <alias name="testAlias3" id="3">
    <value>#PRINT "Imagine that here goes 1000 lines of your code!"
#PRINT "--------------------------"
#PRINT "--------1000--------------"
#PRINT "--------------------------"</value>
  </alias>


1. Go to the testAlias1 and delete some word(s)
2. Go to the testAlias2 and delete some word(s)
3. Go to the testAlias3 and delete some word(s)

Press Ctrl+Z -> CMUD will undo changes to testAlias3
Press Ctrl+Z -> CMUD will jump to the testAlias2 (note that tree control is not get updated)
Press Ctrl+Z -> CMUD will restore testAlias2
Press Ctrl+Z -> CMUD will jump to the testAlias1
Press Ctrl+Z -> CMUD will restore testAlias1

Click on settings in the tree - you should note that some settings get overwritten with text from another settings.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Feb 17, 2009 4:58 am   
 
I've seen this as well. I'm not sure if anything can been this can be helped. I thought I saw in an an earlier thread ( when the Scintilla editor first went in ) that since CMUD uses a single instance of the scintilla editor you do have to be careful about your undo's across settings.

As for instant back ups when the package is loaded, CMUD already does. If you look in you package directory you should see a PkgName_bak.pkg file in the directory.
_________________
Asati di tempari!
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Tue Feb 17, 2009 5:01 pm   
 
In my package directory I see only untitled_bak.pkg and ColourWheel_bak.pkg. All other packages there do not have any backup copy. Maybe CMUD creates a backup only for packages been loaded in a session other than untitled? That's the only explanation I have.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Feb 17, 2009 6:28 pm   
 
CMUD doesn't create package backups when loading...that slows down the loading time waaaay too much. It creates a backup whenever it tries to read a package that is corrupted and it needs to create a fresh package file. Or, if you use the File/New Package and tell it to overwrite an existing package. It's pretty common for the Untitled to have a backup.

I'll consider adding automatic backup in the future, but honestly it's mostly not useful to just have a single backup. Often you won't notice a problem until the backup file has also been overwritten. For example, zMUD created backup copies of the *.MUD files, and they usually got corrupted too and were pretty useless.

It's really up to users to understand that regular backups of *any* user data files (whether CMUD packages, or Word documents, Excel spreadsheets, etc) is necessary. There are lots of free backup utilities for doing this, or even for "versioning" files to keep multiple backups.

Anyway, back to the main bug. Tech is correct that this bug is caused by the fact that CMUD shares a single editor instance across multiple settings. This is needed because the Scintilla editor takes a lot of memory and is fairly slow to create and initialize. I helped with this problem a bit by creating a separate editor instance for each different setting type (so the Alias editor is separate from the Trigger editor, for example).

I will do some research to determine if there is a way to clear the editor undo stack and then I can try to do that when you switch between different settings. Hopefully it will be possible, but I'll let you know.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net