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.
gh-133363: Fix Cmd completion for lines beginning with
!
#133364New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-133363: Fix Cmd completion for lines beginning with
!
#133364Changes from 1 commit
12e2495
973bef6
1c6248e
c259bef
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do add check here for
!h\t\n
(without space) as well. No need for another method, just another input.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does need to be another method, because the assertions are:
and those would pass if either of the two inputs succeeded, not only if both of them did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we could use a subtest for this? I know how to avoid duplication with pytest, but I'm not really familiar with unittest. Does this work?
Seems to...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean just use the same script and do two
run_pty
- I don't think you even need a subtest. It's a very small case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ello
because that's what is completed?hello
is not part of the output?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, because that's what is used in the previous test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ello
because that's what's completed, yes.hello
is part of the output, but I'm just matching the test above that I copy-pasted from, which only checks forab_completion_test
, hehThe tests do both pass if I adjust them to check for
hello
andtab_completion_test
respectively.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized I co-authored that test. Ha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that even true? I thought the completion never works:
Anyway, normally in the news we only need to say what is fixed, we don't need to do a complete description of what's the previous behavior. News entry should be a concise sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because
parsecmd
is only called ifbegidx > 0
, so in the!foo<Tab>
case (begidx=0 endidx=3) we don't hit this buggy codepath.OK, I've shortened it and just say that it's fixed to reliably call the method, since previously it was inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay but it's still not good, because that's not really a name. It still won't give us the correct completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not worry about that, we can do that in pdb I believe. I don't want to change
cmd
so close to beta freeze. I'll loop back to this after beta freeze.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, though that seems to need a bigger change if you want to fix that... Do you want to special case
!
at the start of the line, and do:Even that's not enough to make PDB's completion work without the space, though, because that'll give a
text="!h"
and PDB will say that none of the object names it knows of start with"!"
. Which means that making that work requires changes in the PDB module, too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong.
!
was by default a delimiter and that's why your current code passes.cmd
is handling this correctly becausebegidx
will>0
when you complete!h<tab>
.pdb
somehow removed!
from delimiters and I did not figure out why. However, we can deal with in pdb only, this is not acmd
issue.