Fix crash when pasting at buffer end

Fixes #4844
This commit is contained in:
Maxime Coste 2023-03-13 21:49:45 +11:00
parent 86dc4130e1
commit 81787792d0
3 changed files with 5 additions and 0 deletions

View File

@ -662,6 +662,8 @@ BufferCoord paste_pos(Buffer& buffer, BufferCoord min, BufferCoord max, PasteMod
switch (mode) switch (mode)
{ {
case PasteMode::Append: case PasteMode::Append:
if (buffer.is_end(max))
return max;
return linewise ? std::min(buffer.line_count(), max.line+1) : buffer.char_next(max); return linewise ? std::min(buffer.line_count(), max.line+1) : buffer.char_next(max);
case PasteMode::Insert: case PasteMode::Insert:
return linewise ? min.line : min; return linewise ? min.line : min;

View File

@ -0,0 +1 @@
<a-o>Cpp

View File

@ -0,0 +1,2 @@