aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlecoanet2007-02-26 15:03:27 +0000
committerlecoanet2007-02-26 15:03:27 +0000
commitaef2863a903c49638e29330531209ff2ecf90273 (patch)
tree4a4041b6360383e9c8aeed25339056b6c4b3cff6
parente8e10f2626454073c53093eecdb4bcbf97df16a8 (diff)
downloadtkzinc-aef2863a903c49638e29330531209ff2ecf90273.zip
tkzinc-aef2863a903c49638e29330531209ff2ecf90273.tar.gz
tkzinc-aef2863a903c49638e29330531209ff2ecf90273.tar.bz2
tkzinc-aef2863a903c49638e29330531209ff2ecf90273.tar.xz
Fixed a off by one error in Text selection drawing
-rw-r--r--generic/Text.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/generic/Text.c b/generic/Text.c
index 96b4974..2d820a0 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -492,7 +492,7 @@ ComputeSelection(ZnItem item,
lines = ZnListArray(text->text_info);
sel_first = Tcl_UtfAtIndex(text->text, ti->sel_first)-text->text;
- sel_last = Tcl_UtfAtIndex(text->text, ti->sel_last+1)-text->text;
+ sel_last = Tcl_UtfAtIndex(text->text, ti->sel_last)-text->text;
for (i = 0, lines_ptr = lines; i < num_lines; i++, lines_ptr++) {
/*
* Compute the selection first and last line as well as
@@ -515,7 +515,7 @@ ComputeSelection(ZnItem item,
/*printf("sel_start_offset 2 : %d\n", *sel_start_offset);*/
}
}
- byte_index = ti->sel_last+1 - line_index;
+ byte_index = ti->sel_last - line_index;
*sel_last_line = i;
if (byte_index == lines_ptr->num_bytes+1)
*sel_stop_offset = lines_ptr->width;
@@ -1554,13 +1554,6 @@ PointToChar(TextItem text,
p.y = ZnNearestInt(p.y);
/*
- * Point above text, returns index 0.
- */
- if (p.y < 0) {
- return 0;
- }
-
- /*
* Find the text line under point.
*/
num_lines = ZnListSize(text->text_info);