forked from aniani/vim
patch 8.1.1416: popup_getposition() not implemented yet
Problem: Popup_getposition() not implemented yet. Solution: Implement it. (Yasuhiro Matsumoto, closes #4449)
This commit is contained in:
@@ -84,11 +84,17 @@ Probably 2. is the best choice.
|
||||
|
||||
IMPLEMENTATION:
|
||||
- Code is in popupwin.c
|
||||
- implement popup_getposition({id}), use in tests
|
||||
- when creating the window set options to Vim default? (verify with 'number')
|
||||
- Do not show tilde below last line.
|
||||
- Implement filter.
|
||||
Check that popup_close() works in the filter.
|
||||
- Handle screen resize in screenalloc().
|
||||
- Make redrawing more efficient and avoid flicker.
|
||||
Fix redrawing problem with completion.
|
||||
Fix redrawing problem when scrolling non-current window
|
||||
Fix redrawing the statusline on top of a popup
|
||||
- Properly figure out the size and position.
|
||||
- Can the buffer be re-used, to avoid using up lots of buffer numbers?
|
||||
- Implement all the unimplemented options and features.
|
||||
|
||||
|
||||
@@ -225,13 +231,16 @@ popup_getoptions({id}) *popup_getoptions()*
|
||||
Return the {options} for popup {id}.
|
||||
|
||||
popup_getposition({id}) *popup_getposition()*
|
||||
{not implemented yet}
|
||||
Return the position and size of popup {id}. Returns a Dict
|
||||
with these entries:
|
||||
col screen column of the popup, one-based
|
||||
line screen line of the popup, one-based
|
||||
width width of the popup in screen cells
|
||||
height height of the popup in screen cells
|
||||
Note that these are the actual screen positions. They differ
|
||||
from the values in `popup_getoptions()` for the sizing and
|
||||
positioning mechanism applied.
|
||||
If popup window {id} is not found an empty Dict is returned.
|
||||
|
||||
win_execute({id}, {command})
|
||||
{not implemented yet}
|
||||
|
@@ -810,6 +810,7 @@ static struct fst
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
{"popup_close", 1, 1, f_popup_close},
|
||||
{"popup_create", 2, 2, f_popup_create},
|
||||
{"popup_getposition", 1, 1, f_popup_getposition},
|
||||
{"popup_hide", 1, 1, f_popup_hide},
|
||||
{"popup_move", 2, 2, f_popup_move},
|
||||
{"popup_show", 1, 1, f_popup_show},
|
||||
|
@@ -487,4 +487,25 @@ f_popup_move(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
redraw_all_later(NOT_VALID);
|
||||
}
|
||||
|
||||
/*
|
||||
* popup_getposition({id})
|
||||
*/
|
||||
void
|
||||
f_popup_getposition(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
dict_T *dict;
|
||||
int id = (int)tv_get_number(argvars);
|
||||
win_T *wp = find_popup_win(id);
|
||||
|
||||
if (rettv_dict_alloc(rettv) == OK)
|
||||
{
|
||||
if (wp == NULL)
|
||||
return; // invalid {id}
|
||||
dict = rettv->vval.v_dict;
|
||||
dict_add_number(dict, "line", wp->w_winrow + 1);
|
||||
dict_add_number(dict, "col", wp->w_wincol + 1);
|
||||
dict_add_number(dict, "width", wp->w_width);
|
||||
dict_add_number(dict, "height", wp->w_height);
|
||||
}
|
||||
}
|
||||
#endif // FEAT_TEXT_PROP
|
||||
|
@@ -3,6 +3,7 @@ void f_popup_create(typval_T *argvars, typval_T *rettv);
|
||||
int popup_any_visible(void);
|
||||
void f_popup_close(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_hide(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_getposition(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_show(typval_T *argvars, typval_T *rettv);
|
||||
void popup_close(int id);
|
||||
void popup_close_tabpage(tabpage_T *tp, int id);
|
||||
|
@@ -159,3 +159,20 @@ func Test_popup_move()
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_popup_getposition()
|
||||
let winid = popup_create('hello', {
|
||||
\ 'line': 2,
|
||||
\ 'col': 3,
|
||||
\ 'minwidth': 10,
|
||||
\ 'minheight': 11,
|
||||
\})
|
||||
redraw
|
||||
let res = popup_getposition(winid)
|
||||
call assert_equal(2, res.line)
|
||||
call assert_equal(3, res.col)
|
||||
call assert_equal(10, res.width)
|
||||
call assert_equal(11, res.height)
|
||||
|
||||
call popup_close(winid)
|
||||
endfunc
|
||||
|
@@ -767,6 +767,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1416,
|
||||
/**/
|
||||
1415,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user