Repeatable edit commands

SyntaxEditor Brainstorming Forum

Posted 16 years ago by Matt Whitfield
Avatar
What would be nice if there was a simple way to

a) Determine if the last edit command was repeatable (which it usually would be)
and
b) Repeat the last edit command

This would be in the same way that, say, Word handles edits.

In my editor, I would choose to say that if the Redo stack had entries, then Ctrl+Y called the Redo method, otherwise it would call the Repeat method.

Comments (5)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In SE4 at least you can tap into KeyTyped to see which EditCommand is executing. Then you could persist that and repeat it as necessary.


Actipro Software Support

Posted 16 years ago by Matt Whitfield
Avatar
Yep - definitely, I just thought that would be a pretty cheap way of making it neater, while not putting the onus on the user to decide which edit commands would want to be repeatable.

However, in Word you can repeat things such as a Replace - which (correct me if i'm wrong) isn't an edit command... So I'm pretty sure in that instance the app would have to cover that one off anyway, at least with the current object model where RaiseEditCommand returns a bool...

I presume making all EditCommands return an object for their result would be OTT?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
RaiseEditCommand just processes the command you pass so really you could just store that. The bool indicates if it occurred or not.

I would think the only thing we could do is track the last command that was executed and have that available for you somewhere.


Actipro Software Support

Posted 16 years ago by Matt Whitfield
Avatar
Yeah I know, I'm really trying to say that an ability to Repeat the last editing action is what would be needed to take it up to the level of something like Word.

Repeat() would equate to RaiseEditCommand(LastEditCommand)

But there are a couple of things that would be needed to bring it up to the level of functionality that Word exhibits -

One would be the fact that an EditCommand would know whether it was repeatable or not. I.e. It doesn't make sense to repeat a command like 'scroll to the end'. It could be argued that really that shouldn't be an EditCommand anyway because it's not really editing anything, just changing the view state.

Another would be the fact that things that aren't currently EditCommand based (for example, a Replace operation) would have to be repeatable.

Just talking about it though, it's becoming apparent that it would be a lot of work to achieve this for you guys. Perhaps it's better in the client app.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Anyone else have any thoughts on the above?


Actipro Software Support