aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.h
blob: 6e0b062fbd256ca3eaba81d5d0ef18befbfe6ebc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef NVIM_TERMINAL_H
#define NVIM_TERMINAL_H

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>

typedef struct terminal Terminal;
typedef void (*terminal_write_cb)(char *buffer, size_t size, void *data);
typedef void (*terminal_resize_cb)(uint16_t width, uint16_t height, void *data);
typedef void (*terminal_close_cb)(void *data);

typedef struct {
  void *data;
  uint16_t width, height;
  terminal_write_cb write_cb;
  terminal_resize_cb resize_cb;
  terminal_close_cb close_cb;
} TerminalOptions;

#define TERMINAL_OPTIONS_INIT ((TerminalOptions) {           \
    .data = NULL,                                            \
    .width = 80,                                             \
    .height = 24,                                            \
    .write_cb = NULL,                                        \
    .resize_cb = NULL,                                       \
    .close_cb = NULL                                         \
    })

#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "terminal.h.generated.h"
#endif
#endif  // NVIM_TERMINAL_H