From 6eafac8dcdd52eb8b1b386747116d9f5a9b63569 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 22 Aug 2023 00:50:52 +0200 Subject: AppDelegate: Set `allowsUndo` on the NSTextView Just discovered this property which enables basic undo/redo functionality on the NSTextView. I can now confirm that the Undo and Redo menu bar items do in fact work. --- src/AppDelegate.m | 1 + src/MainMenu.m | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/AppDelegate.m b/src/AppDelegate.m index 0ee85e9..d6cef3e 100644 --- a/src/AppDelegate.m +++ b/src/AppDelegate.m @@ -33,6 +33,7 @@ _text_view = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]; + [_text_view setAllowsUndo:YES]; [[_window contentView] addSubview:_text_view]; // [_window setContentView:_text_view]; } diff --git a/src/MainMenu.m b/src/MainMenu.m index 91dd051..c8b703d 100644 --- a/src/MainMenu.m +++ b/src/MainMenu.m @@ -211,7 +211,6 @@ NSMenuItem *MainMenuCreateEditMenuItem() keyEquivalent:@""]; NSMenu *edit_menu = [[NSMenu alloc] initWithTitle:@"Edit"]; - // TODO: Undo and redo don't work. [edit_menu addItemWithTitle:@"Undo" action:@selector(undo:) -- cgit v1.2.3