summaryrefslogtreecommitdiff
path: root/src/glibext/gcodebuffer.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-07-01 11:52:52 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-07-01 11:52:52 (GMT)
commit5dcd05f19ac62f6ff922176cd0ae6f8839910f2e (patch)
tree6fbf5798a57ab6874b68b6ea523619481013c814 /src/glibext/gcodebuffer.c
parent51dff92af8ca82ac1cce3f74be70c3705ca88683 (diff)
Built the graph view when defining a target address.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@247 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gcodebuffer.c')
-rw-r--r--src/glibext/gcodebuffer.c12
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)