Re: [vim/vim] Fix :set pumopt command-line completion. (PR #20910)
h_east (Vim Github Repository) <[email protected]> Sun, 02 Aug 2026 03:43:38 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/20910/[email protected]> |
----==_mimepart_6a6f1f5a8bc4e_a0116073439f7
Content-Type: text/plain; charset="UTF-8"
h-east left a comment (vim/vim#20910)
### Line length
if (args->oe_xp->xp_pattern > args->oe_set_arg && *(args->oe_xp->xp_pattern-1) == ':')
This is 90 columns. Please start with
expand_T *xp = args->oe_xp;
like expand_set_diffopt() and expand_set_popupoption() do, then the line fits
and the three call sites are identical.
### Border values
parse_pumopt_border() takes "single", "double" and "round" only when
'encoding' is "utf-8" and 'ambiwidth' is "single":
int can_use_box_chars = (enc_utf8 && *p_ambw == 's');
The new list offers them always, so with 'ambiwidth' set to "double" the
completion gives a value that is then rejected with E474. Please offer them
only under the same condition as the parser.
expand_set_pumborder() completes the same keywords for 'pumborder' and has the
same problem, plus it offers "custom" where the parser wants "custom:". That
one is not from your change, but please do not add a second copy of the list:
put the border styles in one place and use it from both functions. A plain
array cannot leave out the box-drawing styles, so use expand_set_opt_generic()
with a callback; 'pumborder' then adds "margin" and "shadow" on top. The
parser stays the only other place that knows the keywords.
### Tests
Please move the comment before the assert it belongs to, with the same indent
as the rest. The "border:c" line is 81 columns, please wrap it.
Please add a sub-option that follows a comma:
call assert_equal(['single'],
\ getcompletion('set pumopt=shadow,border:s', 'cmdline'))
completing_value_for_subopt_len() checks that the name either starts the value
or follows a comma. 'pumopt' is the first option where a flag without a value
can come first, so 'diffopt' and 'completepopup' do not cover that path.
Please also complete "set pumopt=border:" with nothing after the colon, that
pins the whole list; the "c" prefix only reaches "custom:".
---
By the way, you didn't submit a follow-up PR even a month after the reply here:
https://github.com/vim/vim/pull/20676#issuecomment-4844854787
That's why I submitted #20893 myself. If you had said something beforehand, I could have handled it sooner. Let's try to manage this better next time.
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20910#issuecomment-5157269279
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/20910/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20910/c5157269279%40github.com.
----==_mimepart_6a6f1f5a8bc4e_a0116073439f7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div style=3D"display: flex; flex-wrap: wrap; white-space: pre-wrap; align-=
items: center; "><img height=3D"20" width=3D"20" style=3D"border-radius:50%=
; margin-right: 4px;" decoding=3D"async" src=3D"https://avatars.githubuserc=
ontent.com/u/518808" /><strong>h-east</strong> left a comment <a href=3D"ht=
tps://github.com/vim/vim/pull/20910#issuecomment-5157269279">(vim/vim#20910=
)</a></div>
<h3 dir=3D"auto">Line length</h3>
<pre class=3D"notranslate"><code class=3D"notranslate">if (args->oe_xp-&=
gt;xp_pattern > args->oe_set_arg && *(args->oe_xp->xp_p=
attern-1) =3D=3D ':')
</code></pre>
<p dir=3D"auto">This is 90 columns. Please start with</p>
<pre class=3D"notranslate"><code class=3D"notranslate">expand_T *xp =3D arg=
s->oe_xp;
</code></pre>
<p dir=3D"auto">like expand_set_diffopt() and expand_set_popupoption() do, =
then the line fits<br>
and the three call sites are identical.</p>
<h3 dir=3D"auto">Border values</h3>
<p dir=3D"auto">parse_pumopt_border() takes "single", "double" and "round" =
only when<br>
'encoding' is "utf-8" and 'ambiwidth' is "single":</p>
<pre class=3D"notranslate"><code class=3D"notranslate">int can_use_box_=
chars =3D (enc_utf8 && *p_ambw =3D=3D 's');
</code></pre>
<p dir=3D"auto">The new list offers them always, so with 'ambiwidth' set to=
"double" the<br>
completion gives a value that is then rejected with E474. Please offer the=
m<br>
only under the same condition as the parser.</p>
<p dir=3D"auto">expand_set_pumborder() completes the same keywords for 'pum=
border' and has the<br>
same problem, plus it offers "custom" where the parser wants "custom:". Th=
at<br>
one is not from your change, but please do not add a second copy of the lis=
t:<br>
put the border styles in one place and use it from both functions. A plain=
<br>
array cannot leave out the box-drawing styles, so use expand_set_opt_generi=
c()<br>
with a callback; 'pumborder' then adds "margin" and "shadow" on top. The<b=
r>
parser stays the only other place that knows the keywords.</p>
<h3 dir=3D"auto">Tests</h3>
<p dir=3D"auto">Please move the comment before the assert it belongs to, wi=
th the same indent<br>
as the rest. The "border:c" line is 81 columns, please wrap it.</p>
<p dir=3D"auto">Please add a sub-option that follows a comma:</p>
<pre class=3D"notranslate"><code class=3D"notranslate">call assert_equal(['=
single'],
\ getcompletion('set pumopt=3Dshadow,border:s', 'cmdline'))
</code></pre>
<p dir=3D"auto">completing_value_for_subopt_len() checks that the name eith=
er starts the value<br>
or follows a comma. 'pumopt' is the first option where a flag without a va=
lue<br>
can come first, so 'diffopt' and 'completepopup' do not cover that path.</p=
>
<p dir=3D"auto">Please also complete "set pumopt=3Dborder:" with nothing af=
ter the colon, that<br>
pins the whole list; the "c" prefix only reaches "custom:".</p>
<hr>
<p dir=3D"auto">By the way, you didn't submit a follow-up PR even a month a=
fter the reply here:<br>
<a class=3D"issue-link js-issue-link" data-error-text=3D"Failed to load tit=
le" data-id=3D"4775323848" data-permission-text=3D"Title is private" data-u=
rl=3D"https://github.com/vim/vim/issues/20676" data-hovercard-type=3D"pull_=
request" data-hovercard-url=3D"/vim/vim/pull/20676/hovercard?comment_id=3D4=
844854787&comment_type=3Dissue_comment" href=3D"https://github.com/vim/=
vim/pull/20676#issuecomment-4844854787">#20676 (comment)</a><br>
That's why I submitted <a class=3D"issue-link js-issue-link" data-error-tex=
t=3D"Failed to load title" data-id=3D"5028573922" data-permission-text=3D"T=
itle is private" data-url=3D"https://github.com/vim/vim/issues/20893" data-=
hovercard-type=3D"pull_request" data-hovercard-url=3D"/vim/vim/pull/20893/h=
overcard" href=3D"https://github.com/vim/vim/pull/20893">#20893</a> myself.=
If you had said something beforehand, I could have handled it sooner. Let'=
s try to manage this better next time.</p>
<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&mda=
sh;<br />Reply to this email directly, <a href=3D"https://github.com/vim/vi=
m/pull/20910#issuecomment-5157269279">view it on GitHub</a>, or <a href=3D"=
https://github.com/notifications/unsubscribe-auth/ACY5DGGOY2S5AWDHEIE7ZHT5H=
4LNVAVCNFSNUABEKJSXA33TNF2G64TZHM2DAOJZG42DQMR3JFZXG5LFHM2TAMZXGA4TENRXGGQX=
MAQ">unsubscribe</a>.<br />Triage notifications, keep track of coding agent=
tasks and review pull requests on the go with GitHub Mobile for <a href=3D=
"https://github.com/notifications/mobile/ios/ACY5DGEONMIKSY3C6XSQAHD5H4LNVA=
5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJVG4ZDMOJSG442M4TFM=
FZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ">iOS</a> and <a href=3D=
"https://github.com/notifications/mobile/android/ACY5DGFPNX3QLQOSMJP52XL5H4=
LNVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJVG4ZDMOJSG442M=
4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ">Android</a>.=
Download it today!
<br />You are receiving this because you are subscribed to this thread.<img=
src=3D"https://github.com/notifications/beacon/ACY5DGFUVLUV3XWJLXMWZD35H4L=
NVBFCNFSM6AAAAAC4VTWBKOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3=
TUL5UWJTYAAAAACM3FV4P2M4TFMFZW63VKON2WE43DOJUWEZLE.gif" height=3D"1" width=
=3D"1" alt=3D"" /><span style=3D"color: transparent; font-size: 0; display:=
none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: =
0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><vim/vi=
m/pull/20910/c5157269279</span><span>@</span><span>github</span><span>.</sp=
an><span>com></span></span></p>
<script type=3D"application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/vim/vim/pull/20910#issuecomment-5157269279",
"url": "https://github.com/vim/vim/pull/20910#issuecomment-5157269279",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
<p></p>
-- <br />
-- <br />
You received this message from the "vim_dev" maillist.<br />
Do not top-post! Type your reply below the text you are replying to.<br />
For more information, visit <a href=3D"http://www.vim.org/maillist.php">htt=
p://www.vim.org/maillist.php</a><br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;vim_dev" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">vim_dev+uns=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
vim_dev/vim/vim/pull/20910/c5157269279%40github.com?utm_medium=3Demail&utm_=
source=3Dfooter">https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/209=
10/c5157269279%40github.com</a>.<br />
----==_mimepart_6a6f1f5a8bc4e_a0116073439f7--