diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-12-31 17:37:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 17:37:50 +0100 |
commit | 6427894d891100c0a41f569ecde65bfdce2ea00c (patch) | |
tree | c34bef18907b53dc98e0009ff69a799440080384 /src/nvim/api/ui.c | |
parent | ccbcd390d42d33a15f15c29fab5d6076a6d3ac08 (diff) | |
parent | c72d9ce0a602ba53b99145f64f0d43327a4e3eb3 (diff) | |
download | rneovim-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.c | 24 |
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) { |