popup_create() already supports an opacity field, and 'pumopt' exposes opacity: for the popup menu, but the same key was not accepted by 'completepopup' and 'previewpopup'. Setting :set completepopup=border:on,opacity:50 therefore failed with E474.
https://github.com/vim/vim/pull/20099
(5 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
Thanks, just two minor things I noticed:
In src/popupwin.c:
> + if (x == 0)
+ {
+ wp->w_popup_flags |= POPF_OPACITY;
+ wp->w_popup_blend = 100;
+ }
+ else if (x < 100)
+ {
+ wp->w_popup_flags |= POPF_OPACITY;
+ wp->w_popup_blend = 100 - x;
+ }
+ else
+ {
+ wp->w_popup_flags &= ~POPF_OPACITY;
+ wp->w_popup_blend = 0;
+ }
+ }
That whole part seems a bit redundant?
How about this instead:
if (wp != NULL) { if (x < 100) wp->w_popup_flags |= POPF_OPACITY; else wp->w_popup_flags &= ~POPF_OPACITY; wp->w_popup_blend = 100 - x; }
In src/testdir/test_options.vim:
> @@ -663,6 +663,20 @@ func Test_set_completion_string_values()
call feedkeys(":set completepopup=height:10,align:\<Tab>\<C-B>\"\<CR>", 'xt')
call assert_equal('"set completepopup=height:10,align:item', @:)
call assert_equal([], getcompletion('set completepopup=bogusname:', 'cmdline'))
+
+ " opacity: numeric, 0..100 only
+ call assert_true(index(getcompletion('set completepopup=', 'cmdline'),
+ \ 'opacity:') >= 0)
+ call assert_true(index(getcompletion('set previewpopup=', 'cmdline'),
+ \ 'opacity:') >= 0)
+ set completepopup=border:on,opacity:0
+ set completepopup=border:on,opacity:50
+ set completepopup=border:on,opacity:100
+ call assert_fails('set completepopup=opacity:101', 'E474:')
+ call assert_fails('set completepopup=opacity:abc', 'E474:')
+ set previewpopup=opacity:30
+ call assert_fails('set previewpopup=opacity:200', 'E474:')
can you add this:
call assert_fails('set previewpopup=opacity:-10', 'E474:') call assert_fails('set completeopt=opacity:-10', 'E474:')
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for the review @chrisbra! Both suggestions applied in e761454 — the opacity branch is collapsed as you proposed, and negative-value assert_fails tests added for both completepopup and previewpopup.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()