From 5e005009bc39734c926977eff9cee07461a18d14 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 9 May 2003 14:59:10 +0000 Subject: * (Render, Draw): Drawing is done even for an empty text, just to display the cursor. * (ComputeCoordinates): The bounding box cannot be smaller than the font height to be able to display the cursor. --- generic/Text.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'generic/Text.c') diff --git a/generic/Text.c b/generic/Text.c index 0ab6e30..c2b8278 100644 --- a/generic/Text.c +++ b/generic/Text.c @@ -509,12 +509,13 @@ ComputeCoordinates(ZnItem item, } } /* ISSET(item->inv_flags, INV_TEXT_LAYOUT) */ + + height = font_height; if (text->text_info) { + int h; num_lines = ZnListSize(text->text_info); - height = num_lines * font_height + (num_lines-1) * text->spacing; - } - else { - height = 0; + h = num_lines * font_height + (num_lines-1) * text->spacing; + height = MAX(height, h); } /* @@ -714,9 +715,10 @@ Draw(ZnItem item) int sel_first_line=-1, sel_last_line=-1, cursor_line=-1; unsigned int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0; - if (!text->text_info || !text->text) { + if (!text->text_info/* || !text->text*/) { return; } + lines = (TextLineInfo) ZnListArray(text->text_info); num_lines = ZnListSize(text->text_info); Tk_GetFontMetrics(text->font, &fm); @@ -865,7 +867,7 @@ Render(ZnItem item) int sel_first_line=-1, sel_last_line=-1, cursor_line=-1; int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0; - if (!text->text_info || !text->text || !text->tfi) { + if (!text->text_info || !text->tfi) { return; } -- cgit v1.1