aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-12-31 17:37:50 +0100
committerGitHub <noreply@github.com>2018-12-31 17:37:50 +0100
commit6427894d891100c0a41f569ecde65bfdce2ea00c (patch)
treec34bef18907b53dc98e0009ff69a799440080384 /src/nvim/api/ui.c
parentccbcd390d42d33a15f15c29fab5d6076a6d3ac08 (diff)
parentc72d9ce0a602ba53b99145f64f0d43327a4e3eb3 (diff)
downloadrneovim-6427894d891100c0a41f569ecde65bfdce2ea00c.tar.gz
rneovim-6427894d891100c0a41f569ecde65bfdce2ea00c.tar.bz2
rneovim-6427894d891100c0a41f569ecde65bfdce2ea00c.zip
Merge pull request #8455 from UtkarshMe/grid-split
implement ext_multigrid: draw each window on a separate resizable grid.
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 01f8c9f71c..7ba5251c60 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,28 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
name.data);
}
+/// Tell nvim to resize a grid. Nvim sends grid_resize event with the
+/// requested grid size is within size limits and with maximum allowed size
+/// otherwise.
+///
+/// On invalid grid handle, fails with error.
+///
+/// @param grid The handle of the grid to be changed.
+/// @param width The new requested width.
+/// @param height The new requested height.
+void nvim_ui_try_resize_grid(uint64_t channel_id, Integer grid, Integer width,
+ Integer height, Error *error)
+ FUNC_API_SINCE(6) 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;
+ }
+
+ ui_grid_resize((handle_T)grid, (int)width, (int)height, error);
+}
+
/// Pushes data into UI.UIData, to be consumed later by remote_ui_flush().
static void push_call(UI *ui, const char *name, Array args)
{