Don't draw out of bounds line numbers
This commit is contained in:
@@ -125,6 +125,18 @@ Rect2 Shrink(Rect2 result, float v) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Rect2 ShrinkVertical(Rect2 result, float v) {
|
||||
result.min.y += v;
|
||||
result.max.y -= v;
|
||||
return result;
|
||||
}
|
||||
|
||||
Rect2 ShrinkHorizontal(Rect2 result, float v) {
|
||||
result.min.x += v;
|
||||
result.max.x -= v;
|
||||
return result;
|
||||
}
|
||||
|
||||
Vec2 GetMid(Rect2 r) {
|
||||
Vec2 size = GetSize(r);
|
||||
size.x /= 2.f;
|
||||
|
||||
@@ -170,7 +170,7 @@ void DrawWindow(Window *window) {
|
||||
SetScissor(window->line_numbers_rect);
|
||||
|
||||
Rect2I vlines = GetVisibleCells(window);
|
||||
for (Int line = vlines.min.y; line <= vlines.max.y; line += 1) {
|
||||
for (Int line = vlines.min.y; line <= visible.max.y && line >= 0 && line < buffer->line_starts.len; line += 1) {
|
||||
Scratch scratch;
|
||||
Vec2I pos = {0, line * FontLineSpacing};
|
||||
pos.y -= view->scroll.y;
|
||||
|
||||
Reference in New Issue
Block a user