summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkbufferview.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index 877b041..ac1a8e5 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -216,6 +216,8 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton *
GtkBufferView *view; /* Autre version du composant */
gint real_x; /* Abscisse absolue réelle */
gint real_y; /* Ordonnée absolue réelle */
+ size_t index; /* Indice de ligne de tampon */
+ GBufferLine *line; /* Ligne à la position courante*/
vmpa_t addr; /* Position mémoire associée */
GdkRectangle new; /* Nouvel emplacement calculé */
@@ -227,19 +229,38 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton *
real_y = event->y;
gtk_buffer_view_compute_real_coord(view, &real_x, &real_y);
- printf(" mouse :: (%g ; %g) -> (%d ; %d)\n",
+ printf(" !mouse! :: (%g ; %g) -> (%d ; %d)\n",
event->x, event->y,
real_x, real_y);
- addr = g_buffer_view_compute_caret(view->buffer_view, real_x, real_y, &new);
- if (addr != VMPA_INVALID)
+
+ line = g_buffer_view_find_line_at(view->buffer_view, real_y, &index);
+ if (line == NULL) return FALSE;
+
+
+ if (real_x < view->left_margin)
{
+
+
+
+ printf("Border Line :: %p\n", line);
+
+
+ }
+ else
+ {
+ addr = g_buffer_view_compute_caret(view->buffer_view, line, index, real_x, &new);
+ if (addr == VMPA_INVALID) return FALSE;
+
gtk_buffer_view_compute_relative_coords(view, &view->caret.x, &view->caret.y);
printf(" mouse --old-- :: (%d ; %d)\n",
view->caret.x, view->caret.y);
+ printf(" mouse --new-- :: (%d ; %d)\n",
+ new.x, new.y);
+
gtk_widget_queue_draw_area(GTK_WIDGET(view), view->caret.x, view->caret.y,
view->caret.width, view->caret.height);
@@ -503,7 +524,7 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr)
gtk_style_context_get(gtk_widget_get_style_context(widget), state,
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL);
- cairo_rectangle(cr, fake_x, area.y,view->left_margin, area.y + area.height);
+ cairo_rectangle(cr, fake_x, area.y, view->left_margin, area.y + area.height);
cairo_fill(cr);
gtk_style_context_get(gtk_widget_get_style_context(widget), state,