[vim/vim] patch 9.2.NNNN: duplicated sub-option name check in :set completion (PR #20676)

6 views
Skip to first unread message

Shane Harper

unread,
5:08 AM (15 hours ago) 5:08 AM
to vim/vim, Subscribed

Problem: The same sub-option name check appears ten times.
Solution: Extract the check into new completing_value_for_subopt() function (Shane Harper).

No functional change.

Previously is_borderhighlight in expand_set_popupoption() was always false: STRNCMP was given "highlight:" instead of "borderhighlight:" as its second argument. There was no user-visible problem with this: is_highlight was already true for "borderhighlight:" (it ends in "highlight:") and the completions for both "borderhighlight:" and "highlight:" are the same.

closes: #NNNN


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

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

Commit Summary

  • 0bd1b67 patch 9.2.NNNN: duplicated sub-option name check in :set completion

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20676@github.com>

Shane Harper

unread,
5:22 AM (15 hours ago) 5:22 AM
to vim/vim, Subscribed
shaneharper left a comment (vim/vim#20676)

I intend to create another patch to address a minor problem that existed prior to this patch.

# The following fails. There should be no completions for "invalid_close:" but completions
# for "close:" (['on', 'off']) are generated.
call assert_equal([], getcompletion('set completepopup=invalid_close:', 'cmdline'))


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20676/c4841810351@github.com>

h_east

unread,
6:35 AM (13 hours ago) 6:35 AM
to vim/vim, Subscribed
h-east left a comment (vim/vim#20676)
  • This changes completion-behaviour code but adds no test. Add a regression test that actually fails before this change, i.e. the bogus sub-option case:
    call assert_equal([], getcompletion('set diffopt=Xalgorithm:', 'cmdline'))
    
  • call assert_equal([], getcompletion('set completepopup=invalid_close:', 'cmdline'))
  • Since the helper concentrates the sub-option check in one place, please also anchor it to a sub-option boundary so invalid_close: / Xalgorithm: stop matching, fixing the issue you noted in the same patch.
  • completing_value_for_subopt() takes a runtime char *, so STRLEN() can no longer fold to a compile-time constant; the existing inline form could use STRLEN_LITERAL().
  • The name completing_value_for_subopt() overstates what it does: it is a plain suffix match, so it returns true for invalid_close: too. Either anchor it to a boundary (see above) so the name holds, or give it a name that reflects the suffix check.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20676/c4842445588@github.com>

h_east

unread,
11:27 AM (9 hours ago) 11:27 AM
to vim/vim, Subscribed
h-east left a comment (vim/vim#20676)

Yes, I understand.
With that in mind, I am proposing that we handle the series of corrections in this PR.
I don't think it is necessary to break the changes down into such small increments.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20676/c4845200928@github.com>

Reply all
Reply to author
Forward
0 new messages