API to replace text/bulk insert #124
danielo515
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I'm not exactly sure how your code looks like. Can you post some codes showing a small example of what you're trying to do? I think you can use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello again.
I've been using recently the Text component. It is great, but it has some limitations when you want to insert new text into new buffers.
The first thing that impressed me is that, the neovim API to insert text fails when you provide a length and there is no enough text to replace it. So what you should do instead is to provide the same value for both start and end. Because of this, the default values the Text components uses (which is setting the end to start + length) are not very suitable to insert new text.
After realising that I had to do cleanup before I want to insert new text led me to the conclusion that the better API for my usecase is to provide a buffer and replace it's text entirely. I'm not sure if I can concatenate the Text content somehow or if this use-case is not possible with the current API.
Beta Was this translation helpful? Give feedback.
All reactions