Mercurial > vim
comparison src/popupwin.c @ 17216:11f3cf51d43b v8.1.1608
patch 8.1.1608: the evalfunc.c file is too big
commit https://github.com/vim/vim/commit/f9c85f580b3792f6b95107412972f5360d412ef0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 29 07:41:35 2019 +0200
patch 8.1.1608: the evalfunc.c file is too big
Problem: The evalfunc.c file is too big.
Solution: Move sign functionality to sign.c.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 Jun 2019 07:45:06 +0200 |
parents | 8ca93f88b84a |
children | 5169811b3044 |
comparison
equal
deleted
inserted
replaced
17215:57771dafd317 | 17216:11f3cf51d43b |
---|---|
230 wp->w_wantcol = 1; | 230 wp->w_wantcol = 1; |
231 if (wp->w_wantcol > Columns) | 231 if (wp->w_wantcol > Columns) |
232 wp->w_wantcol = Columns; | 232 wp->w_wantcol = Columns; |
233 | 233 |
234 popup_adjust_position(wp); | 234 popup_adjust_position(wp); |
235 } | |
236 | |
237 /* | |
238 * Set w_firstline to match the current "wp->w_topline". | |
239 */ | |
240 void | |
241 popup_set_firstline(win_T *wp) | |
242 { | |
243 int height = wp->w_height; | |
244 | |
245 wp->w_firstline = wp->w_topline; | |
246 popup_adjust_position(wp); | |
247 | |
248 // we don't want the popup to get smaller, decrement the first line | |
249 // until it doesn't | |
250 while (wp->w_firstline > 1 && wp->w_height < height) | |
251 { | |
252 --wp->w_firstline; | |
253 popup_adjust_position(wp); | |
254 } | |
255 } | |
256 | |
257 /* | |
258 * Handle a click in a popup window, if it is in the scrollbar. | |
259 */ | |
260 void | |
261 popup_handle_scrollbar_click(win_T *wp, int row, int col) | |
262 { | |
263 int height = popup_height(wp); | |
264 int old_topline = wp->w_topline; | |
265 | |
266 if (wp->w_has_scrollbar == 0) | |
267 return; | |
268 if (row >= wp->w_popup_border[0] | |
269 && row < height - wp->w_popup_border[2] | |
270 && col == popup_width(wp) - 1) | |
271 { | |
272 if (row >= height / 2) | |
273 { | |
274 // Click in lower half, scroll down. | |
275 if (wp->w_topline < wp->w_buffer->b_ml.ml_line_count) | |
276 ++wp->w_topline; | |
277 } | |
278 else if (wp->w_topline > 1) | |
279 // click on upper half, scroll up. | |
280 --wp->w_topline; | |
281 if (wp->w_topline != old_topline) | |
282 { | |
283 popup_set_firstline(wp); | |
284 redraw_win_later(wp, NOT_VALID); | |
285 } | |
286 } | |
235 } | 287 } |
236 | 288 |
237 #if defined(FEAT_TIMERS) | 289 #if defined(FEAT_TIMERS) |
238 static void | 290 static void |
239 popup_add_timeout(win_T *wp, int time) | 291 popup_add_timeout(win_T *wp, int time) |
629 int | 681 int |
630 popup_width(win_T *wp) | 682 popup_width(win_T *wp) |
631 { | 683 { |
632 return wp->w_width | 684 return wp->w_width |
633 + wp->w_popup_padding[3] + wp->w_popup_border[3] | 685 + wp->w_popup_padding[3] + wp->w_popup_border[3] |
634 + wp->w_popup_padding[1] + wp->w_popup_border[1]; | 686 + wp->w_popup_padding[1] + wp->w_popup_border[1] |
687 + wp->w_has_scrollbar; | |
635 } | 688 } |
636 | 689 |
637 /* | 690 /* |
638 * Get the padding plus border at the top, adjusted to 1 if there is a title. | 691 * Get the padding plus border at the top, adjusted to 1 if there is a title. |
639 */ | 692 */ |