message.h
Go to the documentation of this file.
1 #ifndef NVIM_MESSAGE_H
2 #define NVIM_MESSAGE_H
3 
4 #include <stdbool.h>
5 #include <stdarg.h>
6 #include <stddef.h>
7 
8 #include "nvim/macros.h"
9 #include "nvim/types.h"
10 #include "nvim/grid_defs.h"
11 #include "nvim/api/private/defs.h"
12 #include "nvim/lib/kvec.h"
13 
14 /*
15  * Types of dialogs passed to do_dialog().
16  */
17 #define VIM_GENERIC 0
18 #define VIM_ERROR 1
19 #define VIM_WARNING 2
20 #define VIM_INFO 3
21 #define VIM_QUESTION 4
22 #define VIM_LAST_TYPE 4 /* sentinel value */
23 
24 /*
25  * Return values for functions like vim_dialogyesno()
26  */
27 #define VIM_YES 2
28 #define VIM_NO 3
29 #define VIM_CANCEL 4
30 #define VIM_ALL 5
31 #define VIM_DISCARDALL 6
32 
34 #define MSG(s) msg((char_u *)(s))
35 
37 #define MSG_ATTR(s, attr) msg_attr((const char *)(s), (attr))
38 
42 #define EMSG(s) emsg((char_u *)(s))
43 
45 #define EMSG2(s, p) emsgf((const char *) (s), (p))
46 
48 #define EMSG3(s, p, q) emsgf((const char *) (s), (p), (q))
49 
51 #define EMSGN(s, n) emsgf((const char *) (s), (int64_t)(n))
52 
54 #define EMSGU(s, n) emsgf((const char *) (s), (uint64_t)(n))
55 
57 #define IEMSG(s) iemsg((const char *)(s))
58 
60 #define IEMSG2(s, p) iemsgf((const char *)(s), (p))
61 
63 #define IEMSGN(s, n) iemsgf((const char *)(s), (int64_t)(n))
64 
66 #define MSG_PUTS(s) msg_puts((const char *)(s))
67 
69 #define MSG_PUTS_ATTR(s, a) msg_puts_attr((const char *)(s), (a))
70 
72 #define MSG_PUTS_TITLE(s) msg_puts_title((const char *)(s))
73 
75 #define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0)
76 
78 #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a))
79 
80 typedef struct {
82  int attr;
84 
85 typedef kvec_t(HlMessageChunk) HlMessage;
86 
88 typedef struct msg_hist {
89  struct msg_hist *next;
91  const char *kind;
92  int attr;
93  bool multiline;
95 
100 
101 EXTERN bool msg_ext_need_clear INIT(= false);
102 
103 // allocated grid for messages. Used when display+=msgsep is set, or
104 // ext_multigrid is active. See also the description at msg_scroll_flush()
106 EXTERN int msg_grid_pos INIT(= 0);
107 
108 // "adjusted" message grid. This grid accepts positions relative to
109 // default_grid. Internally it will be translated to a position on msg_grid
110 // relative to the start of the message area, or directly mapped to default_grid
111 // for legacy (display-=msgsep) message scroll behavior.
112 // // TODO(bfredl): refactor "internal" message logic, msg_row etc
113 // to use the correct positions already.
114 EXTERN ScreenGrid msg_grid_adj INIT(= SCREEN_GRID_INIT);
115 
116 // value of msg_scrolled at latest msg_scroll_flush.
117 EXTERN int msg_scrolled_at_flush INIT(= 0);
118 
119 
120 #ifdef INCLUDE_GENERATED_DECLARATIONS
121 # include "message.h.generated.h"
122 #endif
123 #endif // NVIM_MESSAGE_H
INIT
EXTERN bool msg_ext_need_clear INIT(=false)
types.h
last_msg_hist
MessageHistoryEntry * last_msg_hist
Last message.
Definition: message.c:73
HlMessageChunk::attr
int attr
Definition: message.h:82
HlMessageChunk
Definition: message.h:80
macros.h
grid_defs.h
msg_hist::attr
int attr
Message highlighting.
Definition: message.h:92
defs.h
first_msg_hist
MessageHistoryEntry * first_msg_hist
First message.
Definition: message.c:72
msg_hist
Message history for :messages
Definition: message.h:88
kvec.h
SCREEN_GRID_INIT
#define SCREEN_GRID_INIT
Definition: grid_defs.h:110
String
Definition: defs.h:76
kvec_t
typedef kvec_t(HlMessageChunk) HlMessage
MessageHistoryEntry
struct msg_hist MessageHistoryEntry
Message history for :messages
msg_hist::msg
char_u * msg
Message text.
Definition: message.h:90
EXTERN
#define EXTERN
Definition: macros.h:9
msg_hist::next
struct msg_hist * next
Next message.
Definition: message.h:89
msg_hist::kind
const char * kind
Message kind (for msg_ext)
Definition: message.h:91
msg_hist::multiline
bool multiline
Multiline message.
Definition: message.h:93
char_u
unsigned char char_u
Definition: types.h:12
HlMessageChunk::text
String text
Definition: message.h:81
ScreenGrid
Definition: grid_defs.h:48