-
Notifications
You must be signed in to change notification settings - Fork 156
New 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
fix: use user command lines ranges #825
Merged
wd60622
merged 2 commits into
pwntester:master
from
ldelossa:fix/use-user-command-line-ranges
Jan 28, 2025
Merged
fix: use user command lines ranges #825
wd60622
merged 2 commits into
pwntester:master
from
ldelossa:fix/use-user-command-line-ranges
Jan 28, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a60a757
to
6bca5a5
Compare
Testing a comment from Octo... |
7034a7f
to
f1ecfb2
Compare
ldelossa
commented
Jan 27, 2025
This is a follow to making line selections work via the command line. The crux of the confusion with this is that entering the command line from any other mode then normal, exits that mode, and enters normal mode. Octo was trying to determine a selected line range, retroactively, when adding review comments. However, this doesn't really work since if you highlight a line, then want to run the comment add command, you exit visual mode. All 'state' related to visual mode and visual line rages are greedy and never 'reset' to 0 when visual mode is exited. The "right" way that Vim intends you to figure out if a user command is being ran with a visual selection is by using the options dictionary provided to the command. Octo has a object/action lookup mechanism which hides this user command options dictionary from the handlers. This commit tries to fix the above issue without change how every single object/action is called by creating a global variable `OctoLastCmdOpts` which caches the last command's options. This can be used to gather the line range in which teh command was called. Ideally, the object/action function dispatch function is updated to pass the user-command dictionary to all command handlers, but this is a larger change. Signed-off-by: ldelossa <[email protected]>
f1ecfb2
to
ad33db5
Compare
@raulchen can you test this out and see if it fixes |
raulchen
approved these changes
Jan 28, 2025
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, works fine for me.
wd60622
approved these changes
Jan 28, 2025
Thanks for the quick fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is in response to: #807 (comment)
This is a follow to making line selections work via the command line.
The crux of the confusion with this is that entering the command line from any other mode then normal, exits that mode, and enters normal mode.
Octo was trying to determine a selected line range, retroactively, when adding review comments. However, this doesn't really work since if you highlight a line, then want to run the comment add command, you exit visual mode. All 'state' related to visual mode and visual line rages are greedy and never 'reset' to 0 when visual mode is exited.
The "right" way that Vim intends you to figure out if a user command is being ran with a visual selection is by using the options dictionary provided to the command.
Octo has a object/action lookup mechanism which hides this user command options dictionary from the handlers.
This commit tries to fix the above issue without change how every single object/action is called by creating a global variable
OctoLastCmdOpts
which caches the last command's options. This can be used to gather the line range in which teh command was called.Ideally, the object/action function dispatch function is updated to pass the user-command dictionary to all command handlers, but this is a larger change.
Describe what this PR does / why we need it
Does this pull request fix one issue?
Describe how you did it
Describe how to verify it
Special notes for reviews
Checklist