Files
neovim/src/nvim/ui.h
Justin M. Keyes b9ad12e6c2 UI/nvim_ui_attach(): add override option
Before now, Nvim always degrades UI capabilities to the lowest-common
denominator. For example, if any connected UI has `ext_messages=false`
then `ext_messages=true` requested by any other connected UI is ignored.

Now `nvim_ui_attach()` supports `override=true`, which flips the
behavior: if any UI requests an `ext_*` UI capability then the
capability is enabled (and the legacy behavior is disabled).

Legacy UIs will be broken while a `override=true` UI is connected, but
it's useful for debugging: you can type into the TUI and observe the UI
events from another connected (UI) client. And the legacy UI will
"recover" after the `override=true` UI disconnects.

Example using pynvim:

    >>> n.ui_attach(2048, 2048, rgb=True, override=True, ext_multigrid=True, ext_messages=True, ext_popupmenu=True)
    >>> while True: n.next_message();
2019-05-09 22:27:41 +02:00

70 lines
1.2 KiB
C

#ifndef NVIM_UI_H
#define NVIM_UI_H
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "nvim/globals.h"
#include "nvim/api/private/defs.h"
#include "nvim/highlight_defs.h"
typedef enum {
kUICmdline = 0,
kUIPopupmenu,
kUITabline,
kUIWildmenu,
kUIMessages,
#define kUIGlobalCount kUILinegrid
kUILinegrid,
kUIMultigrid,
kUIHlState,
kUITermColors,
kUIFloatDebug,
kUIExtCount,
} UIExtension;
EXTERN const char *ui_ext_names[] INIT(= {
"ext_cmdline",
"ext_popupmenu",
"ext_tabline",
"ext_wildmenu",
"ext_messages",
"ext_linegrid",
"ext_multigrid",
"ext_hlstate",
"ext_termcolors",
"_debug_float",
});
typedef struct ui_t UI;
enum {
kLineFlagWrap = 1,
kLineFlagInvalid = 2,
};
typedef int LineFlags;
struct ui_t {
bool rgb;
bool override; ///< Force highest-requested UI capabilities.
bool composed;
bool ui_ext[kUIExtCount]; ///< Externalized UI capabilities.
int width;
int height;
void *data;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_events.generated.h"
#endif
void (*inspect)(UI *ui, Dictionary *info);
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui.h.generated.h"
# include "ui_events_call.h.generated.h"
#endif
#endif // NVIM_UI_H