From 81354f84a463ef782f53358a3a3f9b359ece9a64 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sun, 6 Aug 2023 22:48:10 -0400 Subject: rework edit notify --- ted.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'ted.c') diff --git a/ted.c b/ted.c index 175e905..14cc440 100644 --- a/ted.c +++ b/ted.c @@ -859,3 +859,23 @@ void ted_color_settings_for_message_type(MessageType type, ColorSetting *bg_colo } } + +u64 ted_add_edit_notify(Ted *ted, EditNotify notify, void *context) { + EditNotifyInfo info = { + .fn = notify, + .context = context, + .id = ++ted->edit_notify_id, + }; + arr_add(ted->edit_notifys, info); + return info.id; +} + +void ted_remove_edit_notify(Ted *ted, EditNotifyID id) { + u32 i; + for (i = 0; i < arr_len(ted->edit_notifys); ++i) { + if (ted->edit_notifys[i].id == id) { + arr_remove(ted->edit_notifys, i); + break; + } + } +} -- cgit v1.2.3