summaryrefslogtreecommitdiff
path: root/src/glibext/gcodebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext/gcodebuffer.c')
-rw-r--r--src/glibext/gcodebuffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c
index fda2c01..75c2e94 100644
--- a/src/glibext/gcodebuffer.c
+++ b/src/glibext/gcodebuffer.c
@@ -461,6 +461,8 @@ void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, Gd
last = first + (event->area.height / view->line_height);
if (event->area.height % view->line_height > 0) last++;
+ last = MIN(last, view->buffer->used > 0 ? view->buffer->used - 1 : 0);
+
y = event->area.y - (real_y % view->line_height);