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(highlight): fix eol highlight not displaying #1988

Merged
merged 3 commits into from
May 19, 2024

Conversation

xiyaowong
Copy link
Collaborator

@xiyaowong xiyaowong commented May 19, 2024

Close #1987

@@ -33,7 +37,18 @@ export function calculateEditorColFromVimScreenCol(line: string, screenCol: numb
}

if (currentCharIdx >= line.length) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ollien Here we cannot use width; what we need is character index

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice catch. I had a test failure on one of the double-wide unit tests but must have fixed it otherwise

@@ -630,6 +630,26 @@ describe("processHighlightCellsEvent", () => {
},
],
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for carrying this over. If you would be so kind, would you mind adding a case for where the Math.max will trigger return 0, when calculating eolCol?

@xiyaowong xiyaowong merged commit 9e208f2 into vscode-neovim:master May 19, 2024
7 of 8 checks passed
@@ -17,10 +17,14 @@ export function expandTabs(line: string, tabWidth: number): string {
return expanded;
}

/**
* Note: This function is for use by the highlight module only.
*/
export function calculateEditorColFromVimScreenCol(line: string, screenCol: number, tabSize: number): number {
Copy link
Collaborator

Choose a reason for hiding this comment

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

off topic: this could be named getColFromNvimCol without any loss of clarity, while reducing verbosity.

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.

None yet

3 participants