Mercurial > vim
comparison src/popupwin.c @ 17241:3ada3d207b33 v8.1.1620
patch 8.1.1620: no test for popup window with border and mask
commit https://github.com/vim/vim/commit/ba45f1f4fbff1a78ed5786c2608b0f8a76ec53c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 3 22:50:41 2019 +0200
patch 8.1.1620: no test for popup window with border and mask
Problem: No test for popup window with border and mask.
Solution: Add this popup window, fix problems.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 03 Jul 2019 23:00:09 +0200 |
parents | 2a97167854fc |
children | 13a2d3364b3f |
comparison
equal
deleted
inserted
replaced
17240:c8a73240f8aa | 17241:3ada3d207b33 |
---|---|
2335 int popup_attr; | 2335 int popup_attr; |
2336 int border_attr[4]; | 2336 int border_attr[4]; |
2337 int border_char[8]; | 2337 int border_char[8]; |
2338 char_u buf[MB_MAXBYTES]; | 2338 char_u buf[MB_MAXBYTES]; |
2339 int row; | 2339 int row; |
2340 int wincol; | |
2340 int padcol = 0; | 2341 int padcol = 0; |
2341 int padwidth = 0; | 2342 int padwidth = 0; |
2342 int i; | 2343 int i; |
2343 int sb_thumb_top = 0; | 2344 int sb_thumb_top = 0; |
2344 int sb_thumb_height = 0; | 2345 int sb_thumb_height = 0; |
2407 border_attr[i] = popup_attr; | 2408 border_attr[i] = popup_attr; |
2408 if (wp->w_border_highlight[i] != NULL) | 2409 if (wp->w_border_highlight[i] != NULL) |
2409 border_attr[i] = syn_name2attr(wp->w_border_highlight[i]); | 2410 border_attr[i] = syn_name2attr(wp->w_border_highlight[i]); |
2410 } | 2411 } |
2411 | 2412 |
2413 wincol = wp->w_wincol - wp->w_popup_leftoff; | |
2412 top_padding = wp->w_popup_padding[0]; | 2414 top_padding = wp->w_popup_padding[0]; |
2413 if (wp->w_popup_border[0] > 0) | 2415 if (wp->w_popup_border[0] > 0) |
2414 { | 2416 { |
2415 // top border | 2417 // top border |
2416 screen_fill(wp->w_winrow, wp->w_winrow + 1, | 2418 screen_fill(wp->w_winrow, wp->w_winrow + 1, |
2417 wp->w_wincol, | 2419 wincol < 0 ? 0 : wincol, wincol + total_width, |
2418 wp->w_wincol + total_width, | 2420 wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0 |
2419 wp->w_popup_border[3] != 0 | |
2420 ? border_char[4] : border_char[0], | 2421 ? border_char[4] : border_char[0], |
2421 border_char[0], border_attr[0]); | 2422 border_char[0], border_attr[0]); |
2422 if (wp->w_popup_border[1] > 0) | 2423 if (wp->w_popup_border[1] > 0 && wp->w_popup_rightoff == 0) |
2423 { | 2424 { |
2424 buf[mb_char2bytes(border_char[5], buf)] = NUL; | 2425 buf[mb_char2bytes(border_char[5], buf)] = NUL; |
2425 screen_puts(buf, wp->w_winrow, | 2426 screen_puts(buf, wp->w_winrow, |
2426 wp->w_wincol + total_width - 1, border_attr[1]); | 2427 wincol + total_width - 1, border_attr[1]); |
2427 } | 2428 } |
2428 } | 2429 } |
2429 else if (wp->w_popup_padding[0] == 0 && popup_top_extra(wp) > 0) | 2430 else if (wp->w_popup_padding[0] == 0 && popup_top_extra(wp) > 0) |
2430 top_padding = 1; | 2431 top_padding = 1; |
2431 | 2432 |
2432 if (top_padding > 0 || wp->w_popup_padding[2] > 0) | 2433 if (top_padding > 0 || wp->w_popup_padding[2] > 0) |
2433 { | 2434 { |
2434 padcol = wp->w_wincol - wp->w_popup_leftoff + wp->w_popup_border[3]; | 2435 padcol = wincol + wp->w_popup_border[3]; |
2435 padwidth = wp->w_wincol + total_width - wp->w_popup_border[1] | 2436 padwidth = wp->w_wincol + total_width - wp->w_popup_border[1] |
2436 - wp->w_has_scrollbar; | 2437 - wp->w_has_scrollbar; |
2437 if (padcol < 0) | 2438 if (padcol < 0) |
2438 { | 2439 { |
2439 padwidth += padcol; | 2440 padwidth += padcol; |
2477 | 2478 |
2478 for (i = wp->w_popup_border[0]; | 2479 for (i = wp->w_popup_border[0]; |
2479 i < total_height - wp->w_popup_border[2]; ++i) | 2480 i < total_height - wp->w_popup_border[2]; ++i) |
2480 { | 2481 { |
2481 int pad_left; | 2482 int pad_left; |
2482 int col = wp->w_wincol - wp->w_popup_leftoff; | |
2483 // left and right padding only needed next to the body | 2483 // left and right padding only needed next to the body |
2484 int do_padding = | 2484 int do_padding = |
2485 i >= wp->w_popup_border[0] + wp->w_popup_padding[0] | 2485 i >= wp->w_popup_border[0] + wp->w_popup_padding[0] |
2486 && i < total_height - wp->w_popup_border[2] | 2486 && i < total_height - wp->w_popup_border[2] |
2487 - wp->w_popup_padding[2]; | 2487 - wp->w_popup_padding[2]; |
2488 | 2488 |
2489 row = wp->w_winrow + i; | 2489 row = wp->w_winrow + i; |
2490 | 2490 |
2491 // left border | 2491 // left border |
2492 if (wp->w_popup_border[3] > 0 && col >= 0) | 2492 if (wp->w_popup_border[3] > 0 && wincol >= 0) |
2493 { | 2493 { |
2494 buf[mb_char2bytes(border_char[3], buf)] = NUL; | 2494 buf[mb_char2bytes(border_char[3], buf)] = NUL; |
2495 screen_puts(buf, row, col, border_attr[3]); | 2495 screen_puts(buf, row, wincol, border_attr[3]); |
2496 } | 2496 } |
2497 if (do_padding && wp->w_popup_padding[3] > 0) | 2497 if (do_padding && wp->w_popup_padding[3] > 0) |
2498 { | 2498 { |
2499 int col = wincol + wp->w_popup_border[3]; | |
2500 | |
2499 // left padding | 2501 // left padding |
2500 col += wp->w_popup_border[3]; | |
2501 pad_left = wp->w_popup_padding[3]; | 2502 pad_left = wp->w_popup_padding[3]; |
2502 if (col < 0) | 2503 if (col < 0) |
2503 { | 2504 { |
2504 pad_left += col; | 2505 pad_left += col; |
2505 col = 0; | 2506 col = 0; |
2524 } | 2525 } |
2525 // right border | 2526 // right border |
2526 if (wp->w_popup_border[1] > 0) | 2527 if (wp->w_popup_border[1] > 0) |
2527 { | 2528 { |
2528 buf[mb_char2bytes(border_char[1], buf)] = NUL; | 2529 buf[mb_char2bytes(border_char[1], buf)] = NUL; |
2529 screen_puts(buf, row, | 2530 screen_puts(buf, row, wincol + total_width - 1, border_attr[1]); |
2530 wp->w_wincol + total_width - 1, border_attr[1]); | |
2531 } | 2531 } |
2532 // right padding | 2532 // right padding |
2533 if (do_padding && wp->w_popup_padding[1] > 0) | 2533 if (do_padding && wp->w_popup_padding[1] > 0) |
2534 screen_puts(get_spaces(wp->w_popup_padding[1]), row, | 2534 screen_puts(get_spaces(wp->w_popup_padding[1]), row, |
2535 wp->w_wincol - wp->w_popup_leftoff | 2535 wincol + wp->w_popup_border[3] |
2536 + wp->w_popup_border[3] | |
2537 + wp->w_popup_padding[3] + wp->w_width + wp->w_leftcol, | 2536 + wp->w_popup_padding[3] + wp->w_width + wp->w_leftcol, |
2538 popup_attr); | 2537 popup_attr); |
2539 } | 2538 } |
2540 | 2539 |
2541 if (wp->w_popup_padding[2] > 0) | 2540 if (wp->w_popup_padding[2] > 0) |
2550 if (wp->w_popup_border[2] > 0) | 2549 if (wp->w_popup_border[2] > 0) |
2551 { | 2550 { |
2552 // bottom border | 2551 // bottom border |
2553 row = wp->w_winrow + total_height - 1; | 2552 row = wp->w_winrow + total_height - 1; |
2554 screen_fill(row , row + 1, | 2553 screen_fill(row , row + 1, |
2555 wp->w_wincol, | 2554 wincol < 0 ? 0 : wincol, |
2556 wp->w_wincol + total_width, | 2555 wincol + total_width, |
2557 wp->w_popup_border[3] != 0 | 2556 wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0 |
2558 ? border_char[7] : border_char[2], | 2557 ? border_char[7] : border_char[2], |
2559 border_char[2], border_attr[2]); | 2558 border_char[2], border_attr[2]); |
2560 if (wp->w_popup_border[1] > 0) | 2559 if (wp->w_popup_border[1] > 0) |
2561 { | 2560 { |
2562 buf[mb_char2bytes(border_char[6], buf)] = NUL; | 2561 buf[mb_char2bytes(border_char[6], buf)] = NUL; |
2563 screen_puts(buf, row, | 2562 screen_puts(buf, row, wincol + total_width - 1, border_attr[2]); |
2564 wp->w_wincol + total_width - 1, border_attr[2]); | |
2565 } | 2563 } |
2566 } | 2564 } |
2567 | 2565 |
2568 if (wp->w_popup_close == POPCLOSE_BUTTON) | 2566 if (wp->w_popup_close == POPCLOSE_BUTTON) |
2569 { | 2567 { |
2570 // close button goes on top of anything at the top-right corner | 2568 // close button goes on top of anything at the top-right corner |
2571 buf[mb_char2bytes('X', buf)] = NUL; | 2569 buf[mb_char2bytes('X', buf)] = NUL; |
2572 screen_puts(buf, wp->w_winrow, wp->w_wincol + total_width - 1, | 2570 screen_puts(buf, wp->w_winrow, wincol + total_width - 1, |
2573 wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr); | 2571 wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr); |
2574 } | 2572 } |
2575 | 2573 |
2576 update_popup_transparent(wp, 0); | 2574 update_popup_transparent(wp, 0); |
2577 | 2575 |