diff options
Diffstat (limited to 'src/nvim/api')
-rw-r--r-- | src/nvim/api/private/helpers.c | 18 | ||||
-rw-r--r-- | src/nvim/api/ui.c | 7 | ||||
-rw-r--r-- | src/nvim/api/ui_events.in.h | 13 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index f5cac82315..19a3368c1c 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -712,6 +712,12 @@ String cbuf_to_string(const char *buf, size_t size) }; } +String cstrn_to_string(const char *str, size_t maxsize) + FUNC_ATTR_NONNULL_ALL +{ + return cbuf_to_string(str, strnlen(str, maxsize)); +} + /// Creates a String using the given C string. Unlike /// cstr_to_string this function DOES NOT copy the C string. /// @@ -726,6 +732,18 @@ String cstr_as_string(char *str) FUNC_ATTR_PURE return (String){ .data = str, .size = strlen(str) }; } +/// Return the owned memory of a ga as a String +/// +/// Reinitializes the ga to a valid empty state. +String ga_take_string(garray_T *ga) +{ + String str = { .data = (char *)ga->ga_data, .size = (size_t)ga->ga_len }; + ga->ga_data = NULL; + ga->ga_len = 0; + ga->ga_maxlen = 0; + return str; +} + /// Collects `n` buffer lines into array `l`, optionally replacing newlines /// with NUL. /// diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 91009c950f..9e9be588e3 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -132,6 +132,13 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->ui_ext[kUILinegrid] = true; } + if (ui->ui_ext[kUIMessages]) { + // This uses attribute indicies, so ext_linegrid is needed. + ui->ui_ext[kUILinegrid] = true; + // Cmdline uses the messages area, so it should be externalized too. + ui->ui_ext[kUICmdline] = true; + } + UIData *data = xmalloc(sizeof(UIData)); data->channel_id = channel_id; data->buffer = (Array)ARRAY_DICT_INIT; diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h index ef3ff0f4c2..b57cf8d3ef 100644 --- a/src/nvim/api/ui_events.in.h +++ b/src/nvim/api/ui_events.in.h @@ -141,4 +141,17 @@ void wildmenu_select(Integer selected) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; void wildmenu_hide(void) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; + +void msg_show(String kind, Array content, Boolean replace_last) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_clear(void) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_showcmd(Array content) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_showmode(Array content) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_ruler(Array content) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_history_show(Array entries) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; #endif // NVIM_API_UI_EVENTS_IN_H |