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

visual selection #735

Closed
wants to merge 8 commits into from
Closed

visual selection #735

wants to merge 8 commits into from

Conversation

chewcw
Copy link

@chewcw chewcw commented Jan 27, 2025

I'm not sure if this #734 is a bug or intentional.

My scenario is:
I have a use case to search for current highlighted text in a chat. If i use select.visual, the selection would highlight the entire line as the context, instead of the highlighted text.

So instead of vim.api.nvim_buf_get_lines, i use nvim_buf_get_text to get the exact text i want as the context to the chat, and added a state to track the vim mode. To be honest, I didn't test this intensively, let me know if I am doing something wrong 😄.

chewcw and others added 8 commits January 27, 2025 12:27
Use `nvim_buf_get_text` instead of `nvim_buf_get_lines` to properly handle
column positions in visual selections. Add special handling for Visual Line
mode by adjusting start and end columns accordingly.
- Updated `get_selection` and `highlight_selection` functions to handle
  start and end columns for more precise selection highlighting.
- Modified `ask` function to maintain consistent indentation.
- Added `start_col` and `end_col` fields to selection object in
  `select.lua`.
@jellydn jellydn closed this Feb 6, 2025
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.

2 participants