Mercurial > vim
comparison src/sign.c @ 18603:f249b44039e0 v8.1.2295
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Commit: https://github.com/vim/vim/commit/4eb7dae255abc271cf313d4c75839577f1424183
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 12 22:33:45 2019 +0100
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Problem: If buffer of popup is in another window cursorline sign shows.
Solution: Check the group of the sign.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 12 Nov 2019 22:45:05 +0100 |
parents | 1848b3e07266 |
children | b29d8a06e72c |
comparison
equal
deleted
inserted
replaced
18602:9d6fa65148d2 | 18603:f249b44039e0 |
---|---|
465 * Return the attributes of the first sign placed on line 'lnum' in buffer | 465 * Return the attributes of the first sign placed on line 'lnum' in buffer |
466 * 'buf'. Used when refreshing the screen. Returns TRUE if a sign is found on | 466 * 'buf'. Used when refreshing the screen. Returns TRUE if a sign is found on |
467 * 'lnum', FALSE otherwise. | 467 * 'lnum', FALSE otherwise. |
468 */ | 468 */ |
469 int | 469 int |
470 buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T *sattr) | 470 buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr) |
471 { | 471 { |
472 sign_entry_T *sign; | 472 sign_entry_T *sign; |
473 sign_T *sp; | 473 sign_T *sp; |
474 buf_T *buf = wp->w_buffer; | |
474 | 475 |
475 vim_memset(sattr, 0, sizeof(sign_attrs_T)); | 476 vim_memset(sattr, 0, sizeof(sign_attrs_T)); |
476 | 477 |
477 FOR_ALL_SIGNS_IN_BUF(buf, sign) | 478 FOR_ALL_SIGNS_IN_BUF(buf, sign) |
478 { | 479 { |
479 if (sign->se_lnum > lnum) | 480 if (sign->se_lnum > lnum) |
480 // Signs are sorted by line number in the buffer. No need to check | 481 // Signs are sorted by line number in the buffer. No need to check |
481 // for signs after the specified line number 'lnum'. | 482 // for signs after the specified line number 'lnum'. |
482 break; | 483 break; |
483 | 484 |
484 if (sign->se_lnum == lnum) | 485 if (sign->se_lnum == lnum |
486 # ifdef FEAT_TEXT_PROP | |
487 && sign_in_group(sign, (char_u *)"popupmenu") | |
488 == (WIN_IS_POPUP(wp) ? TRUE : FALSE) | |
489 # endif | |
490 ) | |
485 { | 491 { |
486 sattr->sat_typenr = sign->se_typenr; | 492 sattr->sat_typenr = sign->se_typenr; |
487 sp = find_sign_by_typenr(sign->se_typenr); | 493 sp = find_sign_by_typenr(sign->se_typenr); |
488 if (sp == NULL) | 494 if (sp == NULL) |
489 return FALSE; | 495 return FALSE; |
2631 vim_free(group); | 2637 vim_free(group); |
2632 | 2638 |
2633 return retval; | 2639 return retval; |
2634 } | 2640 } |
2635 | 2641 |
2642 sign_entry_T * | |
2643 get_first_valid_sign(win_T *wp) | |
2644 { | |
2645 sign_entry_T *sign = wp->w_buffer->b_signlist; | |
2646 | |
2647 # ifdef FEAT_TEXT_PROP | |
2648 while (sign != NULL && sign_in_group(sign, (char_u *)"popupmenu") | |
2649 == (WIN_IS_POPUP(wp) ? FALSE : TRUE)) | |
2650 sign = sign->se_next; | |
2651 # endif | |
2652 return sign; | |
2653 } | |
2654 | |
2655 /* | |
2656 * Return TRUE when window "wp" has a column to draw signs in. | |
2657 */ | |
2658 int | |
2659 signcolumn_on(win_T *wp) | |
2660 { | |
2661 // If 'signcolumn' is set to 'number', signs are displayed in the 'number' | |
2662 // column (if present). Otherwise signs are to be displayed in the sign | |
2663 // column. | |
2664 if (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') | |
2665 return get_first_valid_sign(wp) != NULL && !wp->w_p_nu && !wp->w_p_rnu; | |
2666 | |
2667 if (*wp->w_p_scl == 'n') | |
2668 return FALSE; | |
2669 if (*wp->w_p_scl == 'y') | |
2670 return TRUE; | |
2671 return (get_first_valid_sign(wp) != NULL | |
2672 # ifdef FEAT_NETBEANS_INTG | |
2673 || wp->w_buffer->b_has_sign_column | |
2674 # endif | |
2675 ); | |
2676 } | |
2677 | |
2636 /* | 2678 /* |
2637 * "sign_unplace()" function | 2679 * "sign_unplace()" function |
2638 */ | 2680 */ |
2639 void | 2681 void |
2640 f_sign_unplace(typval_T *argvars, typval_T *rettv) | 2682 f_sign_unplace(typval_T *argvars, typval_T *rettv) |