aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorUtkarsh Maheshwari <utkarshme96@gmail.com>2018-06-06 02:59:11 +0530
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:21 +0100
commit01555de2da79eaf6e569e5e6ee7244dbf5f709e5 (patch)
treec4cf93ea7ff63b6282d6ab596d6a155a43f9596f /src/nvim/api/ui.c
parentf102f50ebeca98365b308463c25eb2caffffba51 (diff)
downloadrneovim-01555de2da79eaf6e569e5e6ee7244dbf5f709e5.tar.gz
rneovim-01555de2da79eaf6e569e5e6ee7244dbf5f709e5.tar.bz2
rneovim-01555de2da79eaf6e569e5e6ee7244dbf5f709e5.zip
multigrid: Allow UIs to set grid size different from window size
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 01f8c9f71c..18befd498f 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -126,7 +126,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
}
}
- if (ui->ui_ext[kUIHlState]) {
+ if (ui->ui_ext[kUIHlState] || ui->ui_ext[kUIMultigrid]) {
ui->ui_ext[kUILinegrid] = true;
}
@@ -245,6 +245,23 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
name.data);
}
+/// Sets the inner "width" and "height" of the window grid identified by
+/// "grid" handle. If the grid does not exist, set error.
+void nvim_ui_try_resize_grid(uint64_t channel_id, Integer grid, Integer width,
+ Integer height, Error *error)
+ FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY
+{
+ if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
+ api_set_error(error, kErrorTypeException,
+ "UI not attached to channel: %" PRId64, channel_id);
+ return;
+ }
+
+ // TODO(utkarshme): Check if grid exists
+
+ ui_grid_resize((GridHandle)grid, (int)width, (int)height);
+}
+
/// Pushes data into UI.UIData, to be consumed later by remote_ui_flush().
static void push_call(UI *ui, const char *name, Array args)
{