diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2024-05-11 10:38:28 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 20:21:46 -0600 |
| commit | 07b8e9d8a293d63fd9c1059968b53ad396e9f013 (patch) | |
| tree | 8da02e24e203efbb8772fde0f0689aac87e31574 /vis.h | |
| parent | b7074021b7bfb0932b889b9560dd22df31cef818 (diff) | |
| download | vis-07b8e9d8a293d63fd9c1059968b53ad396e9f013.tar.gz vis-07b8e9d8a293d63fd9c1059968b53ad396e9f013.tar.xz | |
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.
Diffstat (limited to 'vis.h')
| -rw-r--r-- | vis.h | 25 |
1 files changed, 2 insertions, 23 deletions
@@ -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*); /** |
