Fix #4305 by coping with replacement request with start == line after the last #4311
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.
PR Prelude
Thank you for working on YCM! :)
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your PR:
rationale for why I haven't.
actually perform all of these steps.
Why this change is necessary and useful
My understanding, from what reported in #4305 and what I've experienced, is that the existing code was not written with the idea that a
ReplaceChunk
could be fed with astart
that is the line after the last line of the buffer, i.e. when it is== len( vim_buffer )
(I don't think a request can be made with a number higher than that, e.g. "insert from line 9 in a 7-lines file").This change copes with that case by setting
start_line
back to the last line index (I've donestart_line -= 1
, but maybestart_line = len( vim_buffer )
would be better?), and prepending the last line to thereplacement_lines
as originally compmuted.The test I've written passes, and the usecase I've described and screencasted in #4305 is fixed.
[Please explain in detail why the changes in this PR are needed.]
This change is