Fix :AckWindow for word-under-cursor searches #181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #171, this PR only fixes a bug with
:AckWindow
and:AckHelp
.Basically, if an argument was not given, the command doesn't take the word under the cursor, since the locations that are given to the
ack#Ack()
function work as an "args" argument. Separating "args" and "locations" fixes the issue.Since locations are only used internally (if a user enters locations, they'll just be stuck in the catch-all
args
argument), it makes more sense for them to be a list.A different way of handling this would be to provide a dict with "options" or something, ruby-style. That way, any additional params that need to be communicated between functions privately would not need to change the signature.
Or, argument handling could somehow be extracted to a separate function, so every one of
ack#AckWindow
,ack#Ack
and so on invokes it first, something like:Or something. There would still be some extra work, since
ack#AckWindow
callsack#Ack
, so both would have to do argument parsing, so I don't know if it's a good approach.Anyway, I'd rather just go for this solution, since I think it's simple enough and doesn't seem to have a lot of drawbacks. But let me know what you think.