1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 10:02:57 +03:00

Fix window position computation that could get negative with big scroll offsets

This commit is contained in:
Maxime Coste 2015-07-06 13:10:36 +01:00
parent 72b7a8910b
commit 1cbaac5323

View File

@ -132,8 +132,8 @@ static LineCount adapt_view_pos(LineCount line, LineCount offset,
if (line - offset < view_pos) if (line - offset < view_pos)
return std::max(0_line, line - offset); return std::max(0_line, line - offset);
else if (line + offset >= view_pos + view_size) else if (line + offset >= view_pos + view_size)
return std::min(buffer_size - view_size, return std::max(0_line, std::min(buffer_size - view_size,
line + offset - (view_size - 1)); line + offset - (view_size - 1)));
return view_pos; return view_pos;
} }