Skip to content

Fix openfile navigation jumping to wrong line#11

Open
pgmail wants to merge 1 commit intoruben2020:masterfrom
pgmail:fix-openfile-line-navigation
Open

Fix openfile navigation jumping to wrong line#11
pgmail wants to merge 1 commit intoruben2020:masterfrom
pgmail:fix-openfile-line-navigation

Conversation

@pgmail
Copy link

@pgmail pgmail commented Mar 15, 2026

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.
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