robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
05a511996f
master
1#pragma once 2 3#include <stdbool.h> 4#include <stddef.h> 5#include <stdint.h> 6 7#include "nvim/api/private/defs.h" 8#include "nvim/msgpack_rpc/packer_defs.h" 9 10/// Keep in sync with ui_ext_names[] in ui.h 11typedef enum { 12kUICmdline = 0 , 13kUIPopupmenu , 14kUITabline , 15kUIWildmenu , 16kUIMessages , 17#define kUIGlobalCount kUILinegrid 18kUILinegrid , 19kUIMultigrid , 20kUIHlState , 21kUITermColors , 22kUIFloatDebug , 23kUIExtCount , 24}UIExtension ; 25 26enum { 27kLineFlagWrap = 1 , 28kLineFlagInvalid = 2 , 29}; 30 31typedef int LineFlags ; 32 33typedef struct { 34bool rgb ; 35bool override ;///< Force highest-requested UI capabilities. 36bool composed ; 37bool ui_ext [kUIExtCount ];///< UI capabilities/extensions. 38int width ; 39int height ; 40int pum_nlines ;///< actual nr. lines shown in PUM 41bool pum_pos ;///< UI reports back pum position? 42double pum_row ; 43double pum_col ; 44double pum_height ; 45double pum_width ; 46 47// TUI fields. 48char * term_name ; 49char * term_background ;///< Deprecated. No longer needed since background color detection happens 50///< in Lua. To be removed in a future release. 51int term_colors ; 52bool stdin_tty ; 53bool stdout_tty ; 54 55uint64_t channel_id ; 56 57#define UI_BUF_SIZE ARENA_BLOCK_SIZE ///< total buffer size for pending msgpack data. 58/// guaranteed size available for each new event (so packing of simple events 59/// and the header of grid_line will never fail) 60#define EVENT_BUF_SIZE 256 61 62// Fields related to packing 63PackerBuffer packer ; 64 65const char * cur_event ;///< name of current event (might get multiple arglists) 66 67// We start packing the two outermost msgpack arrays before knowing the total 68// number of elements. Thus track the location where array size will need 69// to be written in the msgpack buffer, once the specific array is finished. 70char * nevents_pos ; 71char * ncalls_pos ; 72uint32_t nevents ;///< number of distinct events (top-level args to "redraw" 73uint32_t ncalls ;///< number of calls made to the current event (plus one for the name!) 74bool flushed_events ;///< events where sent to client without "flush" event 75bool incomplete_event ;///< incomplete event might be pending 76 77size_t ncells_pending ;///< total number of cells since last buffer flush 78 79int hl_id ;// Current highlight for legacy put event. 80Integer cursor_row ,cursor_col ;// Intended visible cursor position. 81 82// Position of legacy cursor, used both for drawing and visible user cursor. 83Integer client_row ,client_col ; 84bool wildmenu_active ; 85}RemoteUI ; 86 87typedef struct { 88const char * name ; 89void (* fn )(Array args ); 90}UIClientHandler ;