diff options
author | pommicket <pommicket@gmail.com> | 2023-08-06 22:48:10 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-06 22:48:10 -0400 |
commit | 81354f84a463ef782f53358a3a3f9b359ece9a64 (patch) | |
tree | f60ab47ac87d2f7195f19aefef1fa03d69e71e1d /ted.c | |
parent | 419d5b17f27b8d3dda1e59c6193f1ad9c3d218f8 (diff) |
rework edit notify
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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; + } + } +} |