From aef2863a903c49638e29330531209ff2ecf90273 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 26 Feb 2007 15:03:27 +0000 Subject: Fixed a off by one error in Text selection drawing --- generic/Text.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'generic') 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); -- cgit v1.1