mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-29 14:44:56 +03:00
Fix compute_pos behaviour not to overflow by one line
Thanks to eraserhd for debugging this and proposing an initial fix. Fixes #3414 Close #3418
This commit is contained in:
parent
5466f63eeb
commit
0506de8443
@ -124,6 +124,7 @@ struct TerminalUI::Window::Line
|
||||
|
||||
void TerminalUI::Window::blit(Window& target)
|
||||
{
|
||||
kak_assert(pos.line + lines.size() <= target.lines.size());
|
||||
auto target_line = target.lines.begin() + (size_t)pos.line;
|
||||
for (auto& line : lines)
|
||||
{
|
||||
@ -131,7 +132,7 @@ void TerminalUI::Window::blit(Window& target)
|
||||
target_line->resize(target.size.column);
|
||||
target_line->atoms.insert(target_line->erase_range(pos.column, size.column),
|
||||
line.atoms.begin(), line.atoms.end());
|
||||
++target_line;
|
||||
++target_line;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1030,10 +1031,10 @@ static DisplayCoord compute_pos(DisplayCoord anchor, DisplayCoord size,
|
||||
if (not prefer_above)
|
||||
{
|
||||
pos = anchor + DisplayCoord{1_line};
|
||||
if (pos.line + size.line > rect_end.line)
|
||||
if (pos.line + size.line >= rect_end.line)
|
||||
pos.line = max(rect.pos.line, anchor.line - size.line);
|
||||
}
|
||||
if (pos.column + size.column > rect_end.column)
|
||||
if (pos.column + size.column >= rect_end.column)
|
||||
pos.column = max(rect.pos.column, rect_end.column - size.column);
|
||||
|
||||
if (to_avoid.size != DisplayCoord{})
|
||||
|
Loading…
Reference in New Issue
Block a user