neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

message.h (2277B)


      1 #pragma once
      2 
      3 #include <errno.h>
      4 #include <stdbool.h>
      5 #include <stddef.h>  // IWYU pragma: keep
      6 
      7 #include "nvim/ex_cmds_defs.h"  // IWYU pragma: keep
      8 #include "nvim/grid_defs.h"
      9 #include "nvim/macros_defs.h"
     10 #include "nvim/message_defs.h"  // IWYU pragma: keep
     11 
     12 /// Types of dialogs passed to do_dialog().
     13 enum {
     14  VIM_GENERIC   = 0,
     15  VIM_ERROR     = 1,
     16  VIM_WARNING   = 2,
     17  VIM_INFO      = 3,
     18  VIM_QUESTION  = 4,
     19  VIM_LAST_TYPE = 4,  ///< sentinel value
     20 };
     21 
     22 /// Return values for functions like vim_dialogyesno()
     23 enum {
     24  VIM_YES        = 2,
     25  VIM_NO         = 3,
     26  VIM_CANCEL     = 4,
     27  VIM_ALL        = 5,
     28  VIM_DISCARDALL = 6,
     29 };
     30 
     31 extern MessageHistoryEntry *msg_hist_last;
     32 
     33 EXTERN bool msg_ext_need_clear INIT( = false);
     34 /// Set to true to force grouping a set of message chunks into a single `cmdline_show` event.
     35 EXTERN bool msg_ext_skip_flush INIT( = false);
     36 /// Set to true when message should be appended to previous message line.
     37 EXTERN bool msg_ext_append INIT( = false);
     38 /// Set to true when previous message should be overwritten.
     39 EXTERN bool msg_ext_overwrite INIT( = false);
     40 /// Set to true to avoid setting "verbose" kind for "last set" messages.
     41 EXTERN bool msg_ext_skip_verbose INIT( = false);
     42 
     43 /// allocated grid for messages. Used unless ext_messages is active.
     44 /// See also the description at msg_scroll_flush()
     45 EXTERN ScreenGrid msg_grid INIT( = SCREEN_GRID_INIT);
     46 EXTERN int msg_grid_pos INIT( = 0);
     47 
     48 /// "adjusted" message grid. This grid accepts positions relative to
     49 /// default_grid. Internally it will be translated to a position on msg_grid
     50 /// relative to the start of the message area, or directly mapped to default_grid
     51 /// for legacy (display-=msgsep) message scroll behavior.
     52 /// TODO(bfredl): refactor "internal" message logic, msg_row etc
     53 /// to use the correct positions already.
     54 EXTERN GridView msg_grid_adj INIT( = { 0 });
     55 
     56 /// value of msg_scrolled at latest msg_scroll_flush.
     57 EXTERN int msg_scrolled_at_flush INIT( = 0);
     58 
     59 EXTERN int msg_grid_scroll_discount INIT( = 0);
     60 
     61 EXTERN int msg_listdo_overwrite INIT( = 0);
     62 
     63 #include "message.h.generated.h"
     64 
     65 // Prefer using semsg(), because perror() may send the output to the wrong
     66 // destination and mess up the screen.
     67 #define PERROR(msg) (void)semsg("%s: %s", (msg), strerror(errno))