summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1416
blob: 80bb7da81b37a60974120b090a00af2e887e0900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1416
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1416
Problem:    Popup_getposition() not implemented yet.
Solution:   Implement it. (Yasuhiro Matsumoto, closes #4449)
Files:	    runtime/doc/popup.txt, src/evalfunc.c, src/popupwin.c,
            src/proto/popupwin.pro, src/testdir/test_popupwin.vim


*** ../vim-8.1.1415/runtime/doc/popup.txt	2019-05-27 21:53:53.986229323 +0200
--- runtime/doc/popup.txt	2019-05-29 20:18:24.751509209 +0200
***************
*** 84,94 ****
  
  IMPLEMENTATION:
  - Code is in popupwin.c
! - implement popup_getposition({id}), use in tests
  - Implement filter.
  - Handle screen resize in screenalloc().
  - Make redrawing more efficient and avoid flicker.
  - Properly figure out the size and position.
  - Implement all the unimplemented options and features.
  
  
--- 84,100 ----
  
  IMPLEMENTATION:
  - Code is in popupwin.c
! - 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,237 ****
  		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
  
  win_execute({id}, {command})
  	  	{not implemented yet}
--- 231,246 ----
  		Return the {options} for popup {id}.
  
  popup_getposition({id})					*popup_getposition()*
  		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}
*** ../vim-8.1.1415/src/evalfunc.c	2019-05-28 23:08:12.056648758 +0200
--- src/evalfunc.c	2019-05-29 20:24:24.582101066 +0200
***************
*** 810,815 ****
--- 810,816 ----
  #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},
*** ../vim-8.1.1415/src/popupwin.c	2019-05-27 21:53:53.986229323 +0200
--- src/popupwin.c	2019-05-29 20:22:24.442608839 +0200
***************
*** 487,490 ****
--- 487,511 ----
      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
*** ../vim-8.1.1415/src/proto/popupwin.pro	2019-05-27 21:53:53.990229301 +0200
--- src/proto/popupwin.pro	2019-05-29 20:14:19.844197298 +0200
***************
*** 3,8 ****
--- 3,9 ----
  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);
*** ../vim-8.1.1415/src/testdir/test_popupwin.vim	2019-05-27 21:53:53.990229301 +0200
--- src/testdir/test_popupwin.vim	2019-05-29 20:24:44.730013045 +0200
***************
*** 159,161 ****
--- 159,178 ----
  
    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
*** ../vim-8.1.1415/src/version.c	2019-05-28 23:32:42.942257480 +0200
--- src/version.c	2019-05-29 20:15:28.556034833 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1416,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///