Skip to content

Fix finding the start and end of the current query.#239

Merged
NTBBloodbath merged 1 commit intorest-nvim:mainfrom
PhilRunninger:fix-query-selection
Oct 27, 2023
Merged

Fix finding the start and end of the current query.#239
NTBBloodbath merged 1 commit intorest-nvim:mainfrom
PhilRunninger:fix-query-selection

Conversation

@PhilRunninger
Copy link
Copy Markdown
Contributor

Fixes #173.

This isn't a treesitter solution, but it's at least a quick and easy, if only temporary, patch.

  1. start_request was searching forward from the cursor position. Adding 'b' to the search flags fixed that.
  2. Both start_request and end_request depended on the user having set 'nowrapscan' to prevent wrapping around the end of the file. Such wrapping could result in finding the wrong query. Adding 'W' to the search flags fixed that, and removed the need for the stopline parameter.
  3. Refactored the way last_line is used in end_request.

1. start_request was searching forward from the cursor position. Adding
   'b' to the search flags fixed that.
2. Both start_request and end_request depended on the user having set
   'nowrapscan' to prevent wrapping around the end of the file. Such
   wrapping could result in finding the wrong query. Adding 'W' to the
   search flags fixed that, and removed the need for the stopline
   parameter.
3. Refactored the way last_line is used in end_request.
Copy link
Copy Markdown
Member

@NTBBloodbath NTBBloodbath left a comment

Choose a reason for hiding this comment

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

Thank you so much for this patch. It is indeed a great solution in the meantime :)

@NTBBloodbath NTBBloodbath merged commit b8d6c0a into rest-nvim:main Oct 27, 2023
@PhilRunninger PhilRunninger deleted the fix-query-selection branch October 28, 2023 05:05
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.

wrong query selected in multiple query file

2 participants