diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-11-20 22:23:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-11-20 22:23:57 (GMT) |
commit | d4239799ad149f65e1e480d898ccb16756f4d518 (patch) | |
tree | 2652094bd458505edb9dbcfb7db1c1a8170ce6f1 /src | |
parent | 7c1f85b8197cb02634d06d200f68ce65e9eca717 (diff) |
Located the caret at the right position in case of minimal widths.
Diffstat (limited to 'src')
-rw-r--r-- | src/glibext/gbufferline.c | 33 | ||||
-rw-r--r-- | src/glibext/gbufferline.h | 10 | ||||
-rw-r--r-- | src/glibext/gbufferview.c | 51 | ||||
-rw-r--r-- | src/glibext/gbufferview.h | 8 | ||||
-rw-r--r-- | src/gtkext/gtkblockdisplay.c | 11 | ||||
-rw-r--r-- | src/gtkext/gtkbufferdisplay.c | 9 |
6 files changed, 73 insertions, 49 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index af27426..2a3a04f 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -984,6 +984,7 @@ void g_buffer_line_collect_widths(GBufferLine *line, line_width_summary *summary * Paramètres : line = ligne à venir consulter. * * index = indice de la colonne visée. * * summary = résumé des largeurs maximales. * +* offsets = décalages supplémentaires à appliquer. * * * * Description : Fournit la largeur d'une colonne finalement appliquée. * * * @@ -993,7 +994,7 @@ void g_buffer_line_collect_widths(GBufferLine *line, line_width_summary *summary * * ******************************************************************************/ -gint g_buffer_line_compute_max_width(const GBufferLine *line, BufferLineColumn index, const line_width_summary *summary) +gint g_buffer_line_compute_max_width(const GBufferLine *line, BufferLineColumn index, const line_width_summary *summary, const line_width_summary *offsets) { gint result; /* Largeur à retourner */ @@ -1005,6 +1006,9 @@ gint g_buffer_line_compute_max_width(const GBufferLine *line, BufferLineColumn i else result = summary->max_widths[index]; + if (result < offsets->max_widths[index]) + result = offsets->max_widths[index]; + return result; } @@ -1044,6 +1048,7 @@ const line_segment *g_buffer_line_get_segment_from_coord(const GBufferLine *line * Paramètres : line = ligne à venir consulter. * * summary = résumé des largeurs maximales. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * base = position jusqu'au segment trouvé. [OUT] * * offset = position à la colonne visée. [OUT] * * dir = direction d'un éventuel déplacement en cours. * @@ -1058,7 +1063,7 @@ const line_segment *g_buffer_line_get_segment_from_coord(const GBufferLine *line * * ******************************************************************************/ -bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, gint *base, gint *offset, GdkScrollDirection dir, bool force, col_coord_t *coord) +bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, const line_width_summary *offsets, gint *base, gint *offset, GdkScrollDirection dir, bool force, col_coord_t *coord) { bool result; /* Bilan à retourner */ BufferLineColumn last; /* Dernière colonne remplie */ @@ -1098,7 +1103,7 @@ bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summar if (i < line->merge_start) { - width = g_buffer_line_compute_max_width(line, i, summary); + width = g_buffer_line_compute_max_width(line, i, summary, offsets); /* Si la colonne n'est absolument pas visible, on ne s'arrête pas dessus ! */ if (width == 0) continue; @@ -1172,7 +1177,7 @@ bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summar { if ((i - 1) < line->merge_start) { - width = g_buffer_line_compute_max_width(line, i - 1, summary); + width = g_buffer_line_compute_max_width(line, i - 1, summary, offsets); if (width > 0) *base += (width + COL_MARGIN); @@ -1250,6 +1255,7 @@ bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summar * Paramètres : line = ligne à venir consulter. * * summary = résumé des largeurs maximales. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * base = position jusqu'au segment trouvé. [OUT] * * offset = position à la colonne visée. [OUT] * * dir = direction d'un éventuel déplacement en cours. * @@ -1263,13 +1269,13 @@ bool g_buffer_line_get_coord_at(const GBufferLine *line, const line_width_summar * * ******************************************************************************/ -const line_segment *g_buffer_line_get_segment_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, gint *base, gint *offset, GdkScrollDirection dir, bool force) +const line_segment *g_buffer_line_get_segment_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, const line_width_summary *offsets, gint *base, gint *offset, GdkScrollDirection dir, bool force) { const line_segment *result; /* Trouvaille à retourner */ col_coord_t coord; /* Emplacement du contenu visé */ bool status; /* Bilan de la localisation */ - status = g_buffer_line_get_coord_at(line, summary, options, base, offset, dir, force, &coord); + status = g_buffer_line_get_coord_at(line, summary, options, offsets, base, offset, dir, force, &coord); if (status) result = g_buffer_line_get_segment_from_coord(line, &coord); @@ -1286,6 +1292,7 @@ const line_segment *g_buffer_line_get_segment_at(const GBufferLine *line, const * Paramètres : line = ligne à venir consulter. * * summary = résumé des largeurs maximales. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * base = position jusqu'au segment trouvé. [OUT] * * offset = position à la colonne visée. [OUT] * * dir = direction d'un éventuel déplacement en cours. * @@ -1299,7 +1306,7 @@ const line_segment *g_buffer_line_get_segment_at(const GBufferLine *line, const * * ******************************************************************************/ -GObject *g_buffer_line_get_creator_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, gint *base, gint *offset, GdkScrollDirection dir, bool force) +GObject *g_buffer_line_get_creator_at(const GBufferLine *line, const line_width_summary *summary, const GDisplayOptions *options, const line_width_summary *offsets, gint *base, gint *offset, GdkScrollDirection dir, bool force) { GObject *result; /* Trouvaille à retourner */ col_coord_t target; /* Emplacement du contenu visé */ @@ -1309,7 +1316,7 @@ GObject *g_buffer_line_get_creator_at(const GBufferLine *line, const line_width_ result = NULL; - status = g_buffer_line_get_coord_at(line, summary, options, base, offset, dir, force, &target); + status = g_buffer_line_get_coord_at(line, summary, options, offsets, base, offset, dir, force, &target); if (status) { @@ -1338,6 +1345,7 @@ GObject *g_buffer_line_get_creator_at(const GBufferLine *line, const line_width_ * coord = cordonnées à consulter puis renseigner. [OUT] * * summary = résumé des largeurs maximales. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * dir = orientation des recherches. * * offset = décalage pour amener à l'extrémité nouvelle. [OUT] * * * @@ -1349,7 +1357,7 @@ GObject *g_buffer_line_get_creator_at(const GBufferLine *line, const line_width_ * * ******************************************************************************/ -bool g_buffer_line_find_near_coord(const GBufferLine *line, col_coord_t *coord, const line_width_summary *summary, const GDisplayOptions *options, GdkScrollDirection dir, gint *offset) +bool g_buffer_line_find_near_coord(const GBufferLine *line, col_coord_t *coord, const line_width_summary *summary, const GDisplayOptions *options, const line_width_summary *offsets, GdkScrollDirection dir, gint *offset) { bool result; /* Bilan à retourner */ size_t count; /* Qté de colonnes en option */ @@ -1435,7 +1443,7 @@ bool g_buffer_line_find_near_coord(const GBufferLine *line, col_coord_t *coord, if (displayed) { - width = g_buffer_line_compute_max_width(line, k, summary); + width = g_buffer_line_compute_max_width(line, k, summary, offsets); if (width > 0) { @@ -1535,10 +1543,7 @@ void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const line_width_summ if (i < line->merge_start) { - max_width = g_buffer_line_compute_max_width(line, i, summary); - - if (max_width == 0) - max_width = offsets->max_widths[i]; + max_width = g_buffer_line_compute_max_width(line, i, summary, offsets); if (max_width > 0) x += max_width + COL_MARGIN; diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h index 3fb21fc..1d36d95 100644 --- a/src/glibext/gbufferline.h +++ b/src/glibext/gbufferline.h @@ -193,22 +193,22 @@ typedef struct _col_coord_t void g_buffer_line_collect_widths(GBufferLine *, line_width_summary *); /* Fournit la largeur d'une colonne finalement appliquée. */ -gint g_buffer_line_compute_max_width(const GBufferLine *, BufferLineColumn, const line_width_summary *); +gint g_buffer_line_compute_max_width(const GBufferLine *, BufferLineColumn, const line_width_summary *, const line_width_summary *); /* Fournit le segment présent à une position donnée. */ const line_segment *g_buffer_line_get_segment_from_coord(const GBufferLine *, const col_coord_t *); /* Fournit les coordonnées correspondant à une abscisse donnée. */ -bool g_buffer_line_get_coord_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, gint *, gint *, GdkScrollDirection, bool, col_coord_t *); +bool g_buffer_line_get_coord_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, const line_width_summary *, gint *, gint *, GdkScrollDirection, bool, col_coord_t *); /* Donne le segment présent à une abscisse donnée. */ -const line_segment *g_buffer_line_get_segment_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, gint *, gint *, GdkScrollDirection, bool); +const line_segment *g_buffer_line_get_segment_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, const line_width_summary *, gint *, gint *, GdkScrollDirection, bool); /* Donne le créateur présent à une abscisse donnée. */ -GObject *g_buffer_line_get_creator_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, gint *, gint *, GdkScrollDirection, bool); +GObject *g_buffer_line_get_creator_at(const GBufferLine *, const line_width_summary *, const GDisplayOptions *, const line_width_summary *, gint *, gint *, GdkScrollDirection, bool); /* Fournit des coordonnées voisines selon une direction donnée. */ -bool g_buffer_line_find_near_coord(const GBufferLine *, col_coord_t *, const line_width_summary *, const GDisplayOptions *, GdkScrollDirection, gint *); +bool g_buffer_line_find_near_coord(const GBufferLine *, col_coord_t *, const line_width_summary *, const GDisplayOptions *, const line_width_summary *, GdkScrollDirection, gint *); /* Imprime la ligne de texte représentée. */ void g_buffer_line_draw(GBufferLine *, cairo_t *, const line_width_summary *, gint, gint, const GDisplayOptions *, const line_width_summary *, const segcnt_list *); diff --git a/src/glibext/gbufferview.c b/src/glibext/gbufferview.c index 79a475e..bc8cf54 100644 --- a/src/glibext/gbufferview.c +++ b/src/glibext/gbufferview.c @@ -77,10 +77,10 @@ static void g_buffer_view_finalize(GBufferView *); static void on_buffer_cache_size_changed(const GBufferCache *, bool, size_t, size_t, GBufferView *); /* Calcule la position idéale de curseur pour un point donné. */ -bool _g_buffer_view_compute_caret_full(GBufferView *, gint, GBufferLine *, size_t, const GDisplayOptions *, cairo_rectangle_int_t *, GLineCursor **); +bool _g_buffer_view_compute_caret_full(GBufferView *, gint, GBufferLine *, size_t, const GDisplayOptions *, const line_width_summary *, cairo_rectangle_int_t *, GLineCursor **); /* Déplace le curseur au sein d'une vue de tampon. */ -static bool _g_buffer_view_move_caret(GBufferView *, const GBufferLine *, size_t, cairo_rectangle_int_t *, bool, GdkScrollDirection, const GDisplayOptions *); +static bool _g_buffer_view_move_caret(GBufferView *, const GBufferLine *, size_t, cairo_rectangle_int_t *, bool, GdkScrollDirection, const GDisplayOptions *, const line_width_summary *); /* Fournit la ligne présente à une ordonnée donnée. */ @@ -579,6 +579,7 @@ gint g_buffer_view_get_height(const GBufferView *view) * x = abscisse proposée pour le nouvel emplacement. * * y = ordonnée proposée pour le nouvel emplacement. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * caret = position du curseur à construire. [OUT] * * cursor = emplacement correspondant à cette position. [OUT] * * * @@ -590,7 +591,7 @@ gint g_buffer_view_get_height(const GBufferView *view) * * ******************************************************************************/ -bool g_buffer_view_compute_caret_full(GBufferView *view, gint x, gint y, const GDisplayOptions *options, cairo_rectangle_int_t *caret, GLineCursor **cursor) +bool g_buffer_view_compute_caret_full(GBufferView *view, gint x, gint y, const GDisplayOptions *options, const line_width_summary *offsets, cairo_rectangle_int_t *caret, GLineCursor **cursor) { bool result; /* Bilan à retourner */ gint lheight; /* Hauteur d'une ligne */ @@ -615,7 +616,7 @@ bool g_buffer_view_compute_caret_full(GBufferView *view, gint x, gint y, const G /* Calcul d'une position */ - result = _g_buffer_view_compute_caret_full(view, x, line, index, options, caret, cursor); + result = _g_buffer_view_compute_caret_full(view, x, line, index, options, offsets, caret, cursor); g_object_unref(G_OBJECT(line)); @@ -633,6 +634,7 @@ bool g_buffer_view_compute_caret_full(GBufferView *view, gint x, gint y, const G * line = ligne correspondant à la position. * * index = indice de cette même ligne dans le tampon. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * caret = position du curseur à construire. [OUT] * * cursor = emplacement correspondant à cette position. [OUT] * * * @@ -644,7 +646,7 @@ bool g_buffer_view_compute_caret_full(GBufferView *view, gint x, gint y, const G * * ******************************************************************************/ -bool _g_buffer_view_compute_caret_full(GBufferView *view, gint x, GBufferLine *line, size_t index, const GDisplayOptions *options, cairo_rectangle_int_t *caret, GLineCursor **cursor) +bool _g_buffer_view_compute_caret_full(GBufferView *view, gint x, GBufferLine *line, size_t index, const GDisplayOptions *options, const line_width_summary *offsets, cairo_rectangle_int_t *caret, GLineCursor **cursor) { bool result; /* Bilan à retourner */ gint text_pos; /* Abscisse de départ du texte */ @@ -668,7 +670,7 @@ bool _g_buffer_view_compute_caret_full(GBufferView *view, gint x, GBufferLine *l x -= text_pos; - status = g_buffer_line_get_coord_at(line, &summary, options, &base, &x, + status = g_buffer_line_get_coord_at(line, &summary, options, offsets, &base, &x, GDK_SCROLL_LEFT, true, (col_coord_t []) { { 0 } }); if (!status) @@ -705,6 +707,7 @@ bool _g_buffer_view_compute_caret_full(GBufferView *view, gint x, GBufferLine *l * ctrl = indique la demande d'un parcours rapide. * * dir = direction du parcours. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * * * Description : Déplace le curseur au sein d'une vue de tampon. * * * @@ -714,7 +717,7 @@ bool _g_buffer_view_compute_caret_full(GBufferView *view, gint x, GBufferLine *l * * ******************************************************************************/ -static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line, size_t index, cairo_rectangle_int_t *caret, bool ctrl, GdkScrollDirection dir, const GDisplayOptions *options) +static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line, size_t index, cairo_rectangle_int_t *caret, bool ctrl, GdkScrollDirection dir, const GDisplayOptions *options, const line_width_summary *offsets) { bool result; /* Bilan à retourner */ gint text_pos; /* Abscisse de départ du texte */ @@ -740,7 +743,7 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line /* Déplacement au sein du segment courant ? */ - result = g_buffer_line_get_coord_at(line, &summary, options, &base, &offset, dir, false, &coord); + result = g_buffer_line_get_coord_at(line, &summary, options, offsets, &base, &offset, dir, false, &coord); if (result) { @@ -756,7 +759,7 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line { base = 0; - result = g_buffer_line_find_near_coord(line, &coord, &summary, options, dir, &offset); + result = g_buffer_line_find_near_coord(line, &coord, &summary, options, offsets, dir, &offset); } @@ -778,6 +781,7 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line * ctrl = indique la demande d'un parcours rapide. * * dir = direction du parcours. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * caret = position du curseur à faire évoluer. [OUT] * * cursor = emplacement correspondant à cette position. [OUT] * * * @@ -789,7 +793,7 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line * * ******************************************************************************/ -bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection dir, const GDisplayOptions *options, cairo_rectangle_int_t *caret, GLineCursor **cursor) +bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection dir, const GDisplayOptions *options, const line_width_summary *offsets, cairo_rectangle_int_t *caret, GLineCursor **cursor) { bool result; /* Bilan à retourner */ size_t index; /* Indice de ligne de tampon */ @@ -817,7 +821,8 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d index--; other = g_buffer_cache_find_line_by_index(view->cache, index); - result = _g_buffer_view_compute_caret_full(view, caret->x, other, index, options, caret, cursor); + result = _g_buffer_view_compute_caret_full(view, caret->x, other, index, + options, offsets, caret, cursor); g_object_unref(G_OBJECT(other)); } @@ -831,7 +836,8 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d index++; other = g_buffer_cache_find_line_by_index(view->cache, index); - result = _g_buffer_view_compute_caret_full(view, caret->x, other, index, options, caret, cursor); + result = _g_buffer_view_compute_caret_full(view, caret->x, other, index, + options, offsets, caret, cursor); g_object_unref(G_OBJECT(other)); } @@ -840,7 +846,7 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d case GDK_SCROLL_LEFT: - moved = _g_buffer_view_move_caret(view, line, index, caret, ctrl, GDK_SCROLL_LEFT, options); + moved = _g_buffer_view_move_caret(view, line, index, caret, ctrl, GDK_SCROLL_LEFT, options, offsets); if (moved) { @@ -853,7 +859,8 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d index--; other = g_buffer_cache_find_line_by_index(view->cache, index); - result = _g_buffer_view_compute_caret_full(view, INT_MAX, other, index, options, caret, cursor); + result = _g_buffer_view_compute_caret_full(view, INT_MAX, other, index, + options, offsets, caret, cursor); g_object_unref(G_OBJECT(other)); } @@ -862,7 +869,7 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d case GDK_SCROLL_RIGHT: - moved = _g_buffer_view_move_caret(view, line, index, caret, ctrl, GDK_SCROLL_RIGHT, options); + moved = _g_buffer_view_move_caret(view, line, index, caret, ctrl, GDK_SCROLL_RIGHT, options, offsets); if (moved) { @@ -877,7 +884,8 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d text_pos = g_buffer_cache_get_text_position(view->cache); other = g_buffer_cache_find_line_by_index(view->cache, index); - result = _g_buffer_view_compute_caret_full(view, text_pos, other, index, options, caret, cursor); + result = _g_buffer_view_compute_caret_full(view, text_pos, other, index, + options, offsets, caret, cursor); g_object_unref(G_OBJECT(other)); } @@ -910,6 +918,7 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d * x = abscisse de la zone principale à traiter. * * y = ordonnée de la zone principale à traiter. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * * * Description : Trouve le créateur à l'origine d'un emplacement donné. * * * @@ -919,7 +928,7 @@ bool g_buffer_view_move_caret(GBufferView *view, bool ctrl, GdkScrollDirection d * * ******************************************************************************/ -GObject *g_buffer_view_find_creator(GBufferView *view, gint x, gint y, const GDisplayOptions *options) +GObject *g_buffer_view_find_creator(GBufferView *view, gint x, gint y, const GDisplayOptions *options, const line_width_summary *offsets) { GObject *result; /* Trouvaille à faire remonter */ gint text_pos; /* Abscisse de départ du texte */ @@ -957,7 +966,8 @@ GObject *g_buffer_view_find_creator(GBufferView *view, gint x, gint y, const GDi x -= text_pos; - result = g_buffer_line_get_creator_at(line, &summary, options, (gint []) { 0 }, &x, GDK_SCROLL_LEFT, false); + result = g_buffer_line_get_creator_at(line, &summary, options, offsets, + (gint []) { 0 }, &x, GDK_SCROLL_LEFT, false); g_object_unref(G_OBJECT(line)); @@ -1003,6 +1013,7 @@ bool g_buffer_view_unhighlight_segments(GBufferView *view) * x = abscisse de la zone principale à traiter. * * y = ordonnée de la zone principale à traiter. * * options = règles d'affichage des colonnes modulables. * +* offsets = décalages supplémentaires à appliquer. * * * * Description : Surligne tous les segments similaires à celui sous la souris.* * * @@ -1012,7 +1023,7 @@ bool g_buffer_view_unhighlight_segments(GBufferView *view) * * ******************************************************************************/ -bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const GDisplayOptions *options) +bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const GDisplayOptions *options, const line_width_summary *offsets) { bool result; /* Besoin à faire remonter */ gint text_pos; /* Abscisse de départ du texte */ @@ -1056,7 +1067,7 @@ bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const G x -= text_pos; - segment = g_buffer_line_get_segment_at(line, &summary, options, + segment = g_buffer_line_get_segment_at(line, &summary, options, offsets, (gint []) { 0 }, &x, GDK_SCROLL_LEFT, true); g_object_unref(G_OBJECT(line)); diff --git a/src/glibext/gbufferview.h b/src/glibext/gbufferview.h index 2a678f6..7e29cfd 100644 --- a/src/glibext/gbufferview.h +++ b/src/glibext/gbufferview.h @@ -79,15 +79,15 @@ gint g_buffer_view_get_height(const GBufferView *); /* Calcule la position idéale de curseur pour un point donné. */ -bool g_buffer_view_compute_caret_full(GBufferView *, gint, gint, const GDisplayOptions *, cairo_rectangle_int_t *, GLineCursor **); +bool g_buffer_view_compute_caret_full(GBufferView *, gint, gint, const GDisplayOptions *, const line_width_summary *, cairo_rectangle_int_t *, GLineCursor **); /* Déplace le curseur au sein d'une vue de tampon. */ -bool g_buffer_view_move_caret(GBufferView *, bool, GdkScrollDirection, const GDisplayOptions *, cairo_rectangle_int_t *, GLineCursor **); +bool g_buffer_view_move_caret(GBufferView *, bool, GdkScrollDirection, const GDisplayOptions *, const line_width_summary *, cairo_rectangle_int_t *, GLineCursor **); /* Trouve le créateur à l'origine d'un emplacement donné. */ -GObject *g_buffer_view_find_creator(GBufferView *, gint, gint, const GDisplayOptions *); +GObject *g_buffer_view_find_creator(GBufferView *, gint, gint, const GDisplayOptions *, const line_width_summary *); @@ -95,7 +95,7 @@ GObject *g_buffer_view_find_creator(GBufferView *, gint, gint, const GDisplayOpt bool g_buffer_view_unhighlight_segments(GBufferView *); /* Surligne tous les segments similaires à celui sous la souris. */ -bool g_buffer_view_highlight_segments(GBufferView *, gint, gint, const GDisplayOptions *); +bool g_buffer_view_highlight_segments(GBufferView *, gint, gint, const GDisplayOptions *, const line_width_summary *); /* Imprime la visualisation du tampon de lignes quelconques. */ void g_buffer_view_draw(const GBufferView *, cairo_t *, gint, const cairo_rectangle_int_t *, const GDisplayOptions *, const line_width_summary *, gint *); diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c index 6aaaac6..bbba06c 100644 --- a/src/gtkext/gtkblockdisplay.c +++ b/src/gtkext/gtkblockdisplay.c @@ -261,7 +261,9 @@ static gboolean gtk_block_display_button_press(GtkWidget *widget, GdkEventButton view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display)); - changed = g_buffer_view_highlight_segments(view, real_x, real_y, GTK_DISPLAY_PANEL(display)->options); + changed = g_buffer_view_highlight_segments(view, real_x, real_y, + GTK_DISPLAY_PANEL(display)->options, + >K_BUFFER_DISPLAY(display)->offsets); g_object_unref(G_OBJECT(view)); @@ -312,7 +314,8 @@ static gboolean gtk_block_display_query_tooltip(GtkWidget *widget, gint x, gint real_y = y; gtk_display_panel_compute_real_coord(panel, &real_x, &real_y); - creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, panel->options); + creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, + panel->options, >K_BUFFER_DISPLAY(display)->offsets); if (creator != NULL) { @@ -430,7 +433,9 @@ static bool gtk_block_display_notify_caret_relocation(GtkBlockDisplay *display, view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display)); - result = g_buffer_view_highlight_segments(view, area->x, area->y, GTK_DISPLAY_PANEL(display)->options); + result = g_buffer_view_highlight_segments(view, area->x, area->y, + GTK_DISPLAY_PANEL(display)->options, + >K_BUFFER_DISPLAY(display)->offsets); g_object_unref(G_OBJECT(view)); diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c index 6329668..1989b1c 100644 --- a/src/gtkext/gtkbufferdisplay.c +++ b/src/gtkext/gtkbufferdisplay.c @@ -524,7 +524,8 @@ static gboolean gtk_buffer_display_key_press(GtkWidget *widget, GdkEventKey *eve ctrl = (event->state & GDK_CONTROL_MASK); area = display->caret; - status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->options, &area, &cursor); + status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->options, &display->offsets, + &area, &cursor); if (status) { @@ -745,7 +746,8 @@ GObject *gtk_buffer_display_get_active_object(const GtkBufferDisplay *display) else result = g_buffer_view_find_creator(display->view, display->caret.x, display->caret.y, - GTK_DISPLAY_PANEL(display)->options); + GTK_DISPLAY_PANEL(display)->options, + &display->offsets); return result; @@ -833,7 +835,8 @@ static bool _gtk_buffer_display_move_caret_to(GtkBufferDisplay *display, gint x, panel = GTK_DISPLAY_PANEL(display); - result = g_buffer_view_compute_caret_full(display->view, x, y, panel->options, &new, &cursor); + result = g_buffer_view_compute_caret_full(display->view, x, y, panel->options, &display->offsets, + &new, &cursor); if (result) gtk_buffer_display_relocate_caret(display, &new, cursor); |