Skip to content

Fix openfile navigation jumping to wrong line#11

Merged
ruben2020 merged 1 commit into
ruben2020:masterfrom
pgmail:fix-openfile-line-navigation
Jul 12, 2026
Merged

Fix openfile navigation jumping to wrong line#11
ruben2020 merged 1 commit into
ruben2020:masterfrom
pgmail:fix-openfile-line-navigation

Conversation

@pgmail

@pgmail pgmail commented Mar 15, 2026

Copy link
Copy Markdown

When clicking a search result, the cursor was landing on the wrong
line, typically 20-30 lines away from the correct position.

Two bugs were fixed in the openfile() method of cqtreedataprov.ts:

  1. vscode.Position uses 0-based line numbers but cqsearch returns
    1-based line numbers, so 1 is now subtracted from the line number.

  2. editor.selection was never set, so the cursor never actually moved.
    It stayed at its previous position while revealRange() only scrolled
    the viewport, giving the appearance of a large random offset.

Tested on Linux (Debian 13).

vscode.Position uses 0-based line numbers but cqsearch returns
1-based line numbers. Also added editor.selection to actually
move the cursor, not just scroll the viewport. Without setting
the selection, the cursor stayed at its previous position while
the view scrolled, causing apparent random offsets of 20-30 lines.
@ruben2020

Copy link
Copy Markdown
Owner

Thanks @pgmail for the good fix. I will add your name to the list of contributors.

@ruben2020 ruben2020 merged commit 32d0918 into ruben2020:master Jul 12, 2026
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.

3 participants