fix: reloading an modifiable octo buffer may cause a runtime error #812
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: reloading an modifiable octo buffer may cause a runtime error
Describe what this PR does / why we need it
Fixes a runtime error when reloading modified Octo buffers
Does this pull request fix one issue?
Fixes: #811
Describe how you did it
Simply get the lines of the newly loaded buffer and only cursor reset at
the minimum valid row position.
The real-world reason to fix this is to avoid a subtly but possibly
annoying runtime error when the user performs "Octo comment add" in an
issue buffer and then reloads the buffer without submitting the comment.
Describe how to verify it
Ensured cursor reset works both when Octo buffer is not modified and when modified (add a couple new lines to Octo buffer before reload).
Special notes for reviews
Checklist