summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkCanvText.c4
-rw-r--r--tests/canvText.test15
2 files changed, 16 insertions, 3 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index b025e30..fd5aa38 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvText.c,v 1.4 1999/04/16 01:51:11 stanton Exp $
+ * RCS: @(#) $Id: tkCanvText.c,v 1.5 1999/04/20 22:28:52 rjohnson Exp $
*/
#include <stdio.h>
@@ -631,7 +631,7 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height)
text = textPtr->text;
selFirstChar = textInfoPtr->selectFirst;
selLastChar = textInfoPtr->selectLast;
- if (selLastChar >= textPtr->numChars) {
+ if (selLastChar > textPtr->numChars) {
selLastChar = textPtr->numChars - 1;
}
if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) {
diff --git a/tests/canvText.test b/tests/canvText.test
index f0d9b85..b5933f5 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: canvText.test,v 1.4 1999/04/16 01:51:35 stanton Exp $
+# RCS: @(#) $Id: canvText.test,v 1.5 1999/04/20 22:28:52 rjohnson Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -240,6 +240,19 @@ test canvText-7.8 {DisplayText procedure: not selected} {
.c select clear
update
} {}
+test canvText-7.9 {DisplayText procedure: select end} {
+ catch {destroy .t}
+ toplevel .t
+ canvas .t.c
+ pack .t.c
+ set id [.t.c create text 0 0 -text Dummy -anchor nw]
+ update
+ .t.c select from $id 0
+ .t.c select to $id end
+ update
+ #catch {destroy .t}
+ update
+} {}
test canvText-8.1 {TextInsert procedure: 0 length insert} {
.c insert test end {}