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 
12 /*
13  * Types of dialogs passed to do_dialog().
14  */
15 #define VIM_GENERIC 0
16 #define VIM_ERROR 1
17 #define VIM_WARNING 2
18 #define VIM_INFO 3
19 #define VIM_QUESTION 4
20 #define VIM_LAST_TYPE 4 /* sentinel value */
21 
22 /*
23  * Return values for functions like vim_dialogyesno()
24  */
25 #define VIM_YES 2
26 #define VIM_NO 3
27 #define VIM_CANCEL 4
28 #define VIM_ALL 5
29 #define VIM_DISCARDALL 6
30 
32 #define MSG(s) msg((char_u *)(s))
33 
35 #define MSG_ATTR(s, attr) msg_attr((const char *)(s), (attr))
36 
40 #define EMSG(s) emsg((char_u *)(s))
41 
43 #define EMSG2(s, p) emsgf((const char *) (s), (p))
44 
46 #define EMSG3(s, p, q) emsgf((const char *) (s), (p), (q))
47 
49 #define EMSGN(s, n) emsgf((const char *) (s), (int64_t)(n))
50 
52 #define EMSGU(s, n) emsgf((const char *) (s), (uint64_t)(n))
53 
55 #define IEMSG(s) iemsg((const char *)(s))
56 
58 #define IEMSG2(s, p) iemsgf((const char *)(s), (p))
59 
61 #define IEMSGN(s, n) iemsgf((const char *)(s), (int64_t)(n))
62 
64 #define MSG_PUTS(s) msg_puts((const char *)(s))
65 
67 #define MSG_PUTS_ATTR(s, a) msg_puts_attr((const char *)(s), (a))
68 
70 #define MSG_PUTS_TITLE(s) msg_puts_title((const char *)(s))
71 
73 #define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0)
74 
76 #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a))
77 
79 typedef struct msg_hist {
80  struct msg_hist *next;
82  const char *kind;
83  int attr;
84  bool multiline;
86 
91 
92 EXTERN bool msg_ext_need_clear INIT(= false);
93 
94 // allocated grid for messages. Used when display+=msgsep is set, or
95 // ext_multigrid is active. See also the description at msg_scroll_flush()
97 EXTERN int msg_grid_pos INIT(= 0);
98 
99 // "adjusted" message grid. This grid accepts positions relative to
100 // default_grid. Internally it will be translated to a position on msg_grid
101 // relative to the start of the message area, or directly mapped to default_grid
102 // for legacy (display-=msgsep) message scroll behavior.
103 // // TODO(bfredl): refactor "internal" message logic, msg_row etc
104 // to use the correct positions already.
105 EXTERN ScreenGrid msg_grid_adj INIT(= SCREEN_GRID_INIT);
106 
107 // value of msg_scrolled at latest msg_scroll_flush.
108 EXTERN int msg_scrolled_at_flush INIT(= 0);
109 
110 
111 #ifdef INCLUDE_GENERATED_DECLARATIONS
112 # include "message.h.generated.h"
113 #endif
114 #endif // NVIM_MESSAGE_H
int attr
Message highlighting.
Definition: message.h:83
Message history for :messages
Definition: message.h:79
MessageHistoryEntry * last_msg_hist
Last message.
Definition: message.c:73
#define SCREEN_GRID_INIT
Definition: grid_defs.h:88
#define EXTERN
Definition: macros.h:7
MessageHistoryEntry * first_msg_hist
First message.
Definition: message.c:72
struct msg_hist MessageHistoryEntry
Message history for :messages
char_u * msg
Message text.
Definition: message.h:81
struct msg_hist * next
Next message.
Definition: message.h:80
bool multiline
Multiline message.
Definition: message.h:84
unsigned char char_u
Definition: types.h:11
const char * kind
Message kind (for msg_ext)
Definition: message.h:82
Definition: grid_defs.h:38
EXTERN bool msg_ext_need_clear INIT(=false)