Mercurial > vim
comparison src/popupwin.c @ 21857:1f6dc5b953c4 v8.2.1478
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Commit: https://github.com/vim/vim/commit/558813314d63dd0263a7a86c0496c1e89b5c8cba
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 18 13:04:15 2020 +0200
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Problem: Vim9: cannot use "true" for some popup options.
Solution: Add dict_get_bool(). (closes https://github.com/vim/vim/issues/6725)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 18 Aug 2020 13:15:04 +0200 |
parents | 48f9bf2c677d |
children | 76627c726349 |
comparison
equal
deleted
inserted
replaced
21856:9c11cd6eb442 | 21857:1f6dc5b953c4 |
---|---|
436 wp->w_wantline = nr; | 436 wp->w_wantline = nr; |
437 nr = popup_options_one(d, (char_u *)"col"); | 437 nr = popup_options_one(d, (char_u *)"col"); |
438 if (nr != MAXCOL) | 438 if (nr != MAXCOL) |
439 wp->w_wantcol = nr; | 439 wp->w_wantcol = nr; |
440 | 440 |
441 di = dict_find(d, (char_u *)"fixed", -1); | 441 |
442 if (di != NULL) | 442 nr = dict_get_bool(d, (char_u *)"fixed", -1); |
443 wp->w_popup_fixed = dict_get_number(d, (char_u *)"fixed") != 0; | 443 if (nr != -1) |
444 wp->w_popup_fixed = nr != 0; | |
444 | 445 |
445 { | 446 { |
446 poppos_T ppt = get_pos_entry(d, TRUE); | 447 poppos_T ppt = get_pos_entry(d, TRUE); |
447 | 448 |
448 if (ppt != POPPOS_NONE) | 449 if (ppt != POPPOS_NONE) |
672 { | 673 { |
673 vim_free(wp->w_popup_title); | 674 vim_free(wp->w_popup_title); |
674 wp->w_popup_title = vim_strsave(str); | 675 wp->w_popup_title = vim_strsave(str); |
675 } | 676 } |
676 | 677 |
677 di = dict_find(dict, (char_u *)"wrap", -1); | 678 nr = dict_get_bool(dict, (char_u *)"wrap", -1); |
678 if (di != NULL) | 679 if (nr != -1) |
679 { | |
680 nr = dict_get_number(dict, (char_u *)"wrap"); | |
681 wp->w_p_wrap = nr != 0; | 680 wp->w_p_wrap = nr != 0; |
682 } | 681 |
683 | 682 nr = dict_get_bool(dict, (char_u *)"drag", -1); |
684 di = dict_find(dict, (char_u *)"drag", -1); | 683 if (nr != -1) |
685 if (di != NULL) | 684 { |
686 { | |
687 nr = dict_get_number(dict, (char_u *)"drag"); | |
688 if (nr) | 685 if (nr) |
689 wp->w_popup_flags |= POPF_DRAG; | 686 wp->w_popup_flags |= POPF_DRAG; |
690 else | 687 else |
691 wp->w_popup_flags &= ~POPF_DRAG; | 688 wp->w_popup_flags &= ~POPF_DRAG; |
692 } | 689 } |
693 | 690 |
694 di = dict_find(dict, (char_u *)"posinvert", -1); | 691 nr = dict_get_bool(dict, (char_u *)"posinvert", -1); |
695 if (di != NULL) | 692 if (nr != -1) |
696 { | 693 { |
697 nr = dict_get_number(dict, (char_u *)"posinvert"); | |
698 if (nr) | 694 if (nr) |
699 wp->w_popup_flags |= POPF_POSINVERT; | 695 wp->w_popup_flags |= POPF_POSINVERT; |
700 else | 696 else |
701 wp->w_popup_flags &= ~POPF_POSINVERT; | 697 wp->w_popup_flags &= ~POPF_POSINVERT; |
702 } | 698 } |
703 | 699 |
704 di = dict_find(dict, (char_u *)"resize", -1); | 700 nr = dict_get_bool(dict, (char_u *)"resize", -1); |
705 if (di != NULL) | 701 if (nr != -1) |
706 { | 702 { |
707 nr = dict_get_number(dict, (char_u *)"resize"); | |
708 if (nr) | 703 if (nr) |
709 wp->w_popup_flags |= POPF_RESIZE; | 704 wp->w_popup_flags |= POPF_RESIZE; |
710 else | 705 else |
711 wp->w_popup_flags &= ~POPF_RESIZE; | 706 wp->w_popup_flags &= ~POPF_RESIZE; |
712 } | 707 } |
900 { | 895 { |
901 free_callback(&wp->w_filter_cb); | 896 free_callback(&wp->w_filter_cb); |
902 set_callback(&wp->w_filter_cb, &callback); | 897 set_callback(&wp->w_filter_cb, &callback); |
903 } | 898 } |
904 } | 899 } |
905 di = dict_find(dict, (char_u *)"mapping", -1); | 900 nr = dict_get_bool(dict, (char_u *)"mapping", -1); |
906 if (di != NULL) | 901 if (nr != -1) |
907 { | 902 { |
908 nr = dict_get_number(dict, (char_u *)"mapping"); | |
909 if (nr) | 903 if (nr) |
910 wp->w_popup_flags |= POPF_MAPPING; | 904 wp->w_popup_flags |= POPF_MAPPING; |
911 else | 905 else |
912 wp->w_popup_flags &= ~POPF_MAPPING; | 906 wp->w_popup_flags &= ~POPF_MAPPING; |
913 } | 907 } |
948 set_string_option_direct_in_win(wp, (char_u *)"signcolumn", -1, | 942 set_string_option_direct_in_win(wp, (char_u *)"signcolumn", -1, |
949 (char_u *)"no", OPT_FREE|OPT_LOCAL, 0); | 943 (char_u *)"no", OPT_FREE|OPT_LOCAL, 0); |
950 | 944 |
951 apply_general_options(wp, dict); | 945 apply_general_options(wp, dict); |
952 | 946 |
953 nr = dict_get_number(dict, (char_u *)"hidden"); | 947 nr = dict_get_bool(dict, (char_u *)"hidden", FALSE); |
954 if (nr > 0) | 948 if (nr > 0) |
955 wp->w_popup_flags |= POPF_HIDDEN; | 949 wp->w_popup_flags |= POPF_HIDDEN; |
956 | 950 |
957 popup_mask_refresh = TRUE; | 951 popup_mask_refresh = TRUE; |
958 popup_highlight_curline(wp); | 952 popup_highlight_curline(wp); |