aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ui_defs.h')
-rw-r--r--src/nvim/ui_defs.h65
1 files changed, 28 insertions, 37 deletions
diff --git a/src/nvim/ui_defs.h b/src/nvim/ui_defs.h
index a2071782b6..4d73cc2321 100644
--- a/src/nvim/ui_defs.h
+++ b/src/nvim/ui_defs.h
@@ -5,6 +5,7 @@
#include <stdint.h>
#include "nvim/api/private/defs.h"
+#include "nvim/msgpack_rpc/packer_defs.h"
/// Keep in sync with ui_ext_names[] in ui.h
typedef enum {
@@ -29,25 +30,41 @@ enum {
typedef int LineFlags;
-typedef struct ui_t UI;
-
typedef struct {
+ bool rgb;
+ bool override; ///< Force highest-requested UI capabilities.
+ bool composed;
+ bool ui_ext[kUIExtCount]; ///< Externalized UI capabilities.
+ int width;
+ int height;
+ int pum_nlines; /// actual nr. lines shown in PUM
+ bool pum_pos; /// UI reports back pum position?
+ double pum_row;
+ double pum_col;
+ double pum_height;
+ double pum_width;
+
+ // TUI fields.
+ char *term_name;
+ char *term_background; ///< Deprecated. No longer needed since background color detection happens
+ ///< in Lua. To be removed in a future release.
+ int term_colors;
+ bool stdin_tty;
+ bool stdout_tty;
+
uint64_t channel_id;
-#define UI_BUF_SIZE 4096 ///< total buffer size for pending msgpack data.
+#define UI_BUF_SIZE ARENA_BLOCK_SIZE ///< total buffer size for pending msgpack data.
/// guaranteed size available for each new event (so packing of simple events
/// and the header of grid_line will never fail)
#define EVENT_BUF_SIZE 256
- char buf[UI_BUF_SIZE]; ///< buffer of packed but not yet sent msgpack data
- char *buf_wptr; ///< write head of buffer
+
+// Fields related to packing
+ PackerBuffer packer;
+
const char *cur_event; ///< name of current event (might get multiple arglists)
Array call_buf; ///< buffer for constructing a single arg list (max 16 elements!)
- // state for write_cb, while packing a single arglist to msgpack. This
- // might fail due to buffer overflow.
- size_t pack_totlen;
- char *temp_buf;
-
// We start packing the two outermost msgpack arrays before knowing the total
// number of elements. Thus track the location where array size will need
// to be written in the msgpack buffer, once the specific array is finished.
@@ -65,33 +82,7 @@ typedef struct {
// Position of legacy cursor, used both for drawing and visible user cursor.
Integer client_row, client_col;
bool wildmenu_active;
-} UIData;
-
-struct ui_t {
- bool rgb;
- bool override; ///< Force highest-requested UI capabilities.
- bool composed;
- bool ui_ext[kUIExtCount]; ///< Externalized UI capabilities.
- int width;
- int height;
- int pum_nlines; /// actual nr. lines shown in PUM
- bool pum_pos; /// UI reports back pum position?
- double pum_row;
- double pum_col;
- double pum_height;
- double pum_width;
-
- // TUI fields.
- char *term_name;
- char *term_background; ///< Deprecated. No longer needed since background color detection happens
- ///< in Lua. To be removed in a future release.
- int term_colors;
- bool stdin_tty;
- bool stdout_tty;
-
- // TODO(bfredl): integrate into struct!
- UIData data[1];
-};
+} RemoteUI;
typedef struct {
const char *name;