diff options
author | Daniel Steinberg <dstein64@users.noreply.github.com> | 2022-01-10 13:36:34 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-10 13:36:34 +0000 |
commit | ee63031b572eb7aea27be4c7e3dafba0daaf681b (patch) | |
tree | 5fa4993e27fa0db931e599f40233404efb00490f /src/evalwindow.c | |
parent | b06cfcf5a3b0248527fd70f9323272aa96db2f56 (diff) | |
download | vim-git-ee63031b572eb7aea27be4c7e3dafba0daaf681b.tar.gz |
patch 8.2.4052: not easy to resize a window from a pluginv8.2.4052
Problem: Not easy to resize a window from a plugin.
Solution: Add win_move_separator() and win_move_statusline() functions.
(Daniel Steinberg, closes #9486)
Diffstat (limited to 'src/evalwindow.c')
-rw-r--r-- | src/evalwindow.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index d632debe6..f2d9a0b44 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -836,6 +836,56 @@ f_win_id2win(typval_T *argvars, typval_T *rettv) } /* + * "win_move_separator()" function + */ + void +f_win_move_separator(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + int offset; + + rettv->vval.v_number = FALSE; + + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL)) + return; + + wp = find_win_by_nr_or_id(&argvars[0]); + if (wp == NULL || win_valid_popup(wp)) + return; + + offset = (int)tv_get_number(&argvars[1]); + win_drag_vsep_line(wp, offset); + rettv->vval.v_number = TRUE; +} + +/* + * "win_move_statusline()" function + */ + void +f_win_move_statusline(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + int offset; + + rettv->vval.v_number = FALSE; + + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL)) + return; + + wp = find_win_by_nr_or_id(&argvars[0]); + if (wp == NULL || win_valid_popup(wp)) + return; + + offset = (int)tv_get_number(&argvars[1]); + win_drag_status_line(wp, offset); + rettv->vval.v_number = TRUE; +} + +/* * "win_screenpos()" function */ void |