summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/glibext/linesegment.c15
2 files changed, 19 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fea9acd..243a41a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+16-11-06 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/glibext/linesegment.c:
+ Handle tabulations as small separation paddings.
+
16-11-03 Cyrille Bagard <nocbos@gmail.com>
* plugins/androhelpers/androhelpers.c:
diff --git a/src/glibext/linesegment.c b/src/glibext/linesegment.c
index ee79a22..8306320 100644
--- a/src/glibext/linesegment.c
+++ b/src/glibext/linesegment.c
@@ -532,6 +532,8 @@ line_segment *get_new_line_segment(RenderingTagType type, const char *text, size
char atmp[sizeof(line_segment) + 128]; /* Allocation static facile */
line_segment *content; /* Contenu à mettre en place ? */
+ assert(length > 0);
+
if (length < (sizeof(atmp) - sizeof(line_segment)))
content = (line_segment *)atmp;
else
@@ -710,11 +712,17 @@ gint get_line_segment_width(const line_segment *segment)
gint result; /* Largeur à retourner */
cairo_font_slant_t slant; /* Style d'impression */
cairo_font_weight_t weight; /* Poids de la police */
+ size_t length; /* Taille du texte représenté */
slant = segment->pattern->slant;
weight = segment->pattern->weight;
- result = _seg_params.x_advances[CAIRO_FONT_INDEX(slant, weight)] * strlen(segment->text);
+ length = strlen(segment->text);
+
+ if (length == 1 && segment->text[0] == '\t')
+ length = 2;
+
+ result = _seg_params.x_advances[CAIRO_FONT_INDEX(slant, weight)] * length;
return result;
@@ -843,6 +851,9 @@ void draw_line_segment(const line_segment *segment, cairo_t *cr, gint *x, gint y
cairo_operator_t old; /* Sauvegarde avant changement */
const rendering_color_t *used_fg; /* Couleur d'impression utile */
+ if (segment->text[0] == '\t' && segment->text[1] == '\0')
+ goto small_sep;
+
selected = selection_list_has_segment_content(list, segment);
width = get_line_segment_width(segment);
@@ -890,6 +901,8 @@ void draw_line_segment(const line_segment *segment, cairo_t *cr, gint *x, gint y
cairo_show_text(cr, segment->text);
+ small_sep:
+
*x += width;
}