1
0
forked from aniani/vim

patch 8.2.4052: not easy to resize a window from a plugin

Problem:    Not easy to resize a window from a plugin.
Solution:   Add win_move_separator() and win_move_statusline() functions.
            (Daniel Steinberg, closes #9486)
This commit is contained in:
Daniel Steinberg
2022-01-10 13:36:34 +00:00
committed by Bram Moolenaar
parent b06cfcf5a3
commit ee63031b57
7 changed files with 189 additions and 0 deletions

View File

@@ -835,6 +835,56 @@ f_win_id2win(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = win_id2win(argvars);
}
/*
* "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
*/