aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-08-22 00:50:52 +0200
committerTeddy Wing2023-08-22 00:52:17 +0200
commit6eafac8dcdd52eb8b1b386747116d9f5a9b63569 (patch)
treed80b0de9600754194272d8d2cc9e1dd4af2271d8
parent43b27f370c4299c9b89cb45d9690bab31c421a10 (diff)
downloadBase-Windowed-Application-6eafac8dcdd52eb8b1b386747116d9f5a9b63569.tar.bz2
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.
-rw-r--r--src/AppDelegate.m1
-rw-r--r--src/MainMenu.m1
2 files changed, 1 insertions, 1 deletions
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:)