diff options
Diffstat (limited to 'src/glibext')
-rw-r--r-- | src/glibext/gcodebuffer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c index d5dbc8c..97d6505 100644 --- a/src/glibext/gcodebuffer.c +++ b/src/glibext/gcodebuffer.c @@ -731,7 +731,7 @@ void g_buffer_view_get_size(GBufferView *view, gint *width, gint *height, bool a first = g_code_buffer_get_index_from_address(view->buffer, view->start); last = g_code_buffer_get_index_from_address(view->buffer, view->end); - *height *= (last - first); + *height *= (last - first + 1); } @@ -783,6 +783,7 @@ void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, Gd gint real_y; /* Ordonnée réelle pour tampon */ size_t first; /* Première ligne visée */ + size_t end; /* Dernière ligne avant limite */ size_t last; /* Dernière ligne visée + 1 */ gint y; /* Point de départ + décallage */ @@ -799,16 +800,17 @@ void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, Gd - first = (real_y / view->line_height); + first = g_code_buffer_get_index_from_address(view->buffer, view->start); + first += (real_y / view->line_height); + 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); + end = g_code_buffer_get_index_from_address(view->buffer, view->end); + last = MIN(last, end); y = event->area.y - (real_y % view->line_height); - - lines = view->buffer->lines; if (view->buffer->used > 0) |