summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-06 22:48:10 -0400
committerpommicket <pommicket@gmail.com>2023-08-06 22:48:10 -0400
commit81354f84a463ef782f53358a3a3f9b359ece9a64 (patch)
treef60ab47ac87d2f7195f19aefef1fa03d69e71e1d /ted.c
parent419d5b17f27b8d3dda1e59c6193f1ad9c3d218f8 (diff)
rework edit notify
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c20
1 files changed, 20 insertions, 0 deletions
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;
+ }
+ }
+}