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

migrate to nvim_buf_set_text #52

Closed
numToStr opened this issue Oct 19, 2021 · 2 comments
Closed

migrate to nvim_buf_set_text #52

numToStr opened this issue Oct 19, 2021 · 2 comments
Labels
api New API or change related to API

Comments

@numToStr
Copy link
Owner

Currently, nvim_buf_set_lines() is used which should be replaced with nvim_buf_set_text().

Why?

This is from :h nvim_buf_set_text()

                This is recommended over nvim_buf_set_lines when only
                modifying parts of a line, as extmarks will be preserved on
                non-modified parts of the touched lines.

How?

Currently, comment/uncomment is done by slicing, dicing, and modifying the lines. Because of this we only had to care about line numbers or rows. But for nvim_buf_set_text() we also need to consider the start and end of the starting and ending column to perfectly place/remove the comments

@numToStr numToStr added the api New API or change related to API label Oct 19, 2021
@numToStr
Copy link
Owner Author

Sadly this won't preserve the ordinary marks

@numToStr
Copy link
Owner Author

numToStr commented Nov 3, 2021

I am closing this for now. As it seems, this task is much more involved than I initially thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api New API or change related to API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant