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(opfunc): fix linewise comment for partial visual selection in single line (Bug#476) #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omeyenburg
Copy link

@omeyenburg omeyenburg commented Jul 9, 2024

This PR addresses issue #476 where creating a linewise comment inadvertently produces a blockwise comment under certain conditions, specifically in VISUAL mode when a portion of a single line is selected.

When selecting a part of a single line in VISUAL mode, such as the printf in the following code:

int main() {
    printf("Hello World");
}

Pressing either gc or gb currently results in:

int main() {
    /* printf */("Hello World");
}

For a linewise comment using gc, the expected result should be:

int main() {
    // printf("Hello World");
}

This PR fixes this problem both for the shortcut (gc) and the api command (require'Comment.api'.toggle.linewise.current()). Explicitly using a blockwise comment (e.g. using gb) still works.

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.

1 participant