aboutsummaryrefslogtreecommitdiff
path: root/generic/Text.c
diff options
context:
space:
mode:
authorlecoanet2003-05-09 14:59:10 +0000
committerlecoanet2003-05-09 14:59:10 +0000
commit5e005009bc39734c926977eff9cee07461a18d14 (patch)
treec83ad2e075cb5a360a9b107b88647770436d2b12 /generic/Text.c
parentf800b944fc713fdd428f314c7d4c5bc6317dcb96 (diff)
downloadtkzinc-5e005009bc39734c926977eff9cee07461a18d14.zip
tkzinc-5e005009bc39734c926977eff9cee07461a18d14.tar.gz
tkzinc-5e005009bc39734c926977eff9cee07461a18d14.tar.bz2
tkzinc-5e005009bc39734c926977eff9cee07461a18d14.tar.xz
* (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.
Diffstat (limited to 'generic/Text.c')
-rw-r--r--generic/Text.c14
1 files changed, 8 insertions, 6 deletions
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;
}