100/home/humza/Downloads/sml/dotscape/README.md done with undo/redo functionality (tested and both of them work as expected)

This commit is contained in:
2024-08-08 23:52:49 +01:00
parent 541fdd877f
commit d9c7b753f8
5 changed files with 21 additions and 3 deletions

View File

@@ -21,9 +21,24 @@ struct
fun keyActionCallback mailbox (key, scancode, action, mods) =
if
key = Input.KEY_Z () andalso action <> Input.RELEASE ()
then
if mods = 0x0002 then
(* ctrl-z *)
Mailbox.send (mailbox, UNDO_ACTION)
else if mods = 0x0003 then
(* ctrl-shift-z *)
Mailbox.send (mailbox, REDO_ACTION)
else
(* no action recognised *)
()
else if
key = Input.KEY_Y () andalso action <> Input.RELEASE ()
andalso mods = 0x0002
then Mailbox.send (mailbox, UNDO_ACTION)
else ()
then
(* ctrl-y *)
Mailbox.send (mailbox, REDO_ACTION)
else
()
fun registerCallbacks (window, inputMailbox) =
let