From 73c48f5030de349c15e06968accdb2eb6f481091 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 15 Aug 2005 15:39:31 +0000 Subject: [PATCH] handle tabs.. (jump to next tabstop) SVN revision: 16187 --- legacy/evas/src/lib/canvas/evas_object_textblock.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c index 0afadda630..bf494f1d49 100644 --- a/legacy/evas/src/lib/canvas/evas_object_textblock.c +++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c @@ -91,6 +91,7 @@ struct _Evas_Object_Textblock_Format struct { int l, r; } margin; + int tabstops; unsigned char style; unsigned char wrap_word : 1; unsigned char wrap_char : 1; @@ -1524,6 +1525,11 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd, else if (!strcmp(param, "far_soft_shadow")) fmt->style = STYLE_FAR_SOFT_SHADOW; else fmt->style = STYLE_PLAIN; } + else if (!strcmp(cmd, "tabstops")) + { + fmt->tabstops = atoi(param); + if (fmt->tabstops < 1) fmt->tabstops = 1; + } if (new_font) { @@ -1733,6 +1739,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt) fmt->halign = 0.0; fmt->valign = -1.0; fmt->style = STYLE_PLAIN; + fmt->tabstops = 32; return fmt; } @@ -2298,7 +2305,11 @@ _layout(Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_ret) if (!strcmp(item, "\n")) _layout_line_advance(c, fmt); else if (!strcmp(item, "\t")) - { /* jump to next tabstop */ + { + int x2; + + x2 = (fmt->tabstops * ((c->x + fmt->tabstops) / fmt->tabstops)); + c->x = x2; } } free(item);