[vim/vim] popupwin: accept opacity: in completepopup/previewpopup (PR #20099)

2 views
Skip to first unread message

mattn

unread,
Apr 29, 2026, 10:59:45 PM (2 days ago) Apr 29
to vim/vim, Subscribed

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.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20099

Commit Summary

  • 0a2f5ca popupwin: support "opacity:" in completepopup/previewpopup

File Changes

(5 files)

Patch Links:


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.Message ID: <vim/vim/pull/20099@github.com>

Christian Brabandt

unread,
8:56 AM (4 hours ago) 8:56 AM
to vim/vim, Subscribed

@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.Message ID: <vim/vim/pull/20099/review/4211180309@github.com>

mattn

unread,
9:45 AM (3 hours ago) 9:45 AM
to vim/vim, Push

@mattn pushed 1 commit.

  • e761454 Apply review feedback from PR #20099


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.Message ID: <vim/vim/pull/20099/before/0a2f5cab915871c35f1dbf3037fe10cb4da3078b/after/e761454905d740cacc5e31a1e460375253666514@github.com>

mattn

unread,
9:45 AM (3 hours ago) 9:45 AM
to vim/vim, Subscribed
mattn left a comment (vim/vim#20099)

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.Message ID: <vim/vim/pull/20099/c4359568418@github.com>

Christian Brabandt

unread,
12:35 PM (1 hour ago) 12:35 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20099)

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.Message ID: <vim/vim/pull/20099/c4360386620@github.com>

Christian Brabandt

unread,
12:35 PM (1 hour ago) 12:35 PM
to vim/vim, Subscribed

Closed #20099 via 59e59a6.


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.Message ID: <vim/vim/pull/20099/issue_event/25075985166@github.com>

Reply all
Reply to author
Forward
0 new messages