Skip to content
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: make comment ranges work #807

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

ldelossa
Copy link
Contributor

@ldelossa ldelossa commented Jan 17, 2025

Previous to this comment highlighting several lines and running the command "Octo comment add" would never result in a multi-line comment.

This is seemingly because as soon as you enter the command line with ':' Neovim is switched back into normal mode and the "v" and "." attributes to vim.fn.line no longer register for the line range.

Instead, we can use the explicit start and end marks for a selected range to capture the currently selected range despite being in normal mode at time of command run.

It is now possible to highlight several lines in a review and then call "Octo comment add" to create a multi-line comment.

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

  • Passing tests and linting standards
  • Documentation updates in README.md and doc/octo.txt

@wd60622
Copy link
Collaborator

wd60622 commented Jan 17, 2025

Were there any issues for this?

@ldelossa
Copy link
Contributor Author

Only relevant issue is: #303

But there seems to be a lot of refactoring since then. Possible it broke or most people are using keymaps to create multiline comments? I'm not sure.

I'd want the command to work for multi-line comments, as I already have far too many keymaps and just typing things out are becoming an easier approach.

Previous to this comment highlighting several lines and running the
command "Octo comment add" would never result in a multi-line comment.

This is seemingly because as soon as you enter the command line with
':' Neovim is switched back into normal mode and the "v" and "."
attributes to `vim.fn.line` no longer register for the line range.

Instead, we can use the explicit start and end marks for a selected
range to capture the currently selected range despite being in normal
mode at time of command run.

Signed-off-by: ldelossa <[email protected]>
@ldelossa ldelossa force-pushed the ldelossa/make-comment-ranges-work branch from 559e06e to f369961 Compare January 18, 2025 00:55
@wd60622
Copy link
Collaborator

wd60622 commented Jan 21, 2025

Awesome. Let me take a look tomorrow

Copy link
Collaborator

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm. Nice live quality improvement!

lua/octo/utils.lua Show resolved Hide resolved
@wd60622
Copy link
Collaborator

wd60622 commented Jan 22, 2025

Closes #587

@wd60622 wd60622 linked an issue Jan 22, 2025 that may be closed by this pull request
@wd60622 wd60622 merged commit e20b4f0 into pwntester:master Jan 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

comment add doesn't work for review's visual block
2 participants