1 #ifndef NVIM_MESSAGE_H
2 #define NVIM_MESSAGE_H
3 
4 #include <stdarg.h>
5 #include <stdbool.h>
6 #include <stddef.h>
7 
8 #include "nvim/api/private/defs.h"
9 #include "nvim/grid_defs.h"
10 #include "nvim/lib/kvec.h"
11 #include "nvim/macros.h"
12 #include "nvim/types.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 
33 typedef struct {
34   String text;
35   int attr;
36 } HlMessageChunk;
37 
38 typedef kvec_t(HlMessageChunk) HlMessage;
39 
40 /// Message history for `:messages`
41 typedef struct msg_hist {
42   struct msg_hist *next;  ///< Next message.
43   char_u *msg;            ///< Message text.
44   const char *kind;     ///< Message kind (for msg_ext)
45   int attr;               ///< Message highlighting.
46   bool multiline;         ///< Multiline message.
47 } MessageHistoryEntry;
48 
49 /// First message
50 extern MessageHistoryEntry *first_msg_hist;
51 /// Last message
52 extern MessageHistoryEntry *last_msg_hist;
53 
54 EXTERN bool msg_ext_need_clear INIT(= false);
55 
56 // allocated grid for messages. Used when display+=msgsep is set, or
57 // ext_multigrid is active. See also the description at msg_scroll_flush()
58 EXTERN ScreenGrid msg_grid INIT(= SCREEN_GRID_INIT);
59 EXTERN int msg_grid_pos INIT(= 0);
60 
61 // "adjusted" message grid. This grid accepts positions relative to
62 // default_grid. Internally it will be translated to a position on msg_grid
63 // relative to the start of the message area, or directly mapped to default_grid
64 // for legacy (display-=msgsep) message scroll behavior.
65 // // TODO(bfredl): refactor "internal" message logic, msg_row etc
66 // to use the correct positions already.
67 EXTERN ScreenGrid msg_grid_adj INIT(= SCREEN_GRID_INIT);
68 
69 // value of msg_scrolled at latest msg_scroll_flush.
70 EXTERN int msg_scrolled_at_flush INIT(= 0);
71 
72 
73 #ifdef INCLUDE_GENERATED_DECLARATIONS
74 # include "message.h.generated.h"
75 #endif
76 #endif  // NVIM_MESSAGE_H
77