From 07b8e9d8a293d63fd9c1059968b53ad396e9f013 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Sat, 11 May 2024 10:38:28 -0600 Subject: cleanup vis event interface This removes the function pointer interface which was adding needless complexity and making it difficult to add new events. Now if new events are only meant for lua they only need to be added to the lua interface. This will also have a minor reduction in runtime memory usage and produce a smaller binary. The only runtime difference is that QUIT happens after all windows have been closed and their files freed. --- vis.h | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'vis.h') diff --git a/vis.h b/vis.h index fcc1e05..181083d 100644 --- a/vis.h +++ b/vis.h @@ -40,27 +40,6 @@ typedef struct Win Win; /* maximum bytes needed for string representation of a (pseudo) key */ #define VIS_KEY_LENGTH_MAX 64 -/** - * Editor event handlers. - */ -typedef struct { - void (*init)(Vis*); - void (*start)(Vis*); - void (*quit)(Vis*); - void (*mode_insert_input)(Vis*, const char *key, size_t len); - void (*mode_replace_input)(Vis*, const char *key, size_t len); - void (*file_open)(Vis*, File*); - bool (*file_save_pre)(Vis*, File*, const char *path); - void (*file_save_post)(Vis*, File*, const char *path); - void (*file_close)(Vis*, File*); - void (*win_open)(Vis*, Win*); - void (*win_close)(Vis*, Win*); - void (*win_highlight)(Vis*, Win*); - void (*win_status)(Vis*, Win*); - void (*term_csi)(Vis*, const long *); - void (*ui_draw)(Vis*); -} VisEvent; - /** Union used to pass arguments to key action functions. */ typedef union { bool b; @@ -111,8 +90,8 @@ typedef struct { * @defgroup vis_lifecycle * @{ */ -/** Create a new editor instance using the given user interface and event handlers. */ -Vis *vis_new(Ui*, VisEvent*); +/** Create a new editor instance using the given user interface. */ +Vis *vis_new(Ui*); /** Free all resources associated with this editor instance, terminates UI. */ void vis_free(Vis*); /** -- cgit v1.2.3