summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2005-05-13 13:48:21 (GMT)
committervincentdarley <vincentdarley>2005-05-13 13:48:21 (GMT)
commit00a8d27d5712be73ac8277e02ec7c273c2bce91c (patch)
treea4d042cc7fa55d0676ab2517ac6ec9d70743a8c0
parent1294d5942332fe385343eb33150c3757357b371a (diff)
downloadtk-00a8d27d5712be73ac8277e02ec7c273c2bce91c.zip
tk-00a8d27d5712be73ac8277e02ec7c273c2bce91c.tar.gz
tk-00a8d27d5712be73ac8277e02ec7c273c2bce91c.tar.bz2
backport of text widget bug fix
-rw-r--r--ChangeLog5
-rw-r--r--library/text.tcl4
-rw-r--r--tests/textIndex.test13
3 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f3d8bba..23cbfed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/text.tcl: test and fix to TextPrevPara to avoid infinite loop
+ * tests/textIndex.test: at start of widget [Bug 1191895]
+
2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
* unix/configure: regen
diff --git a/library/text.tcl b/library/text.tcl
index cf40c38..3b2a5ab 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk text widgets and provides
# procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: text.tcl,v 1.24.2.5 2004/12/06 19:42:11 hobbs Exp $
+# RCS: @(#) $Id: text.tcl,v 1.24.2.6 2005/05/13 13:48:21 vincentdarley Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -888,7 +888,7 @@ proc ::tk::TextPrevPara {w pos} {
dummy index]} {
set pos [$w index "$pos + [lindex $index 0] chars"]
}
- if {[$w compare $pos != insert] || [string equal $pos 1.0]} {
+ if {[$w compare $pos != insert] || [lindex [split $pos .] 0] == 1} {
return $pos
}
}
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 98f81bb..12eada2 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: textIndex.test,v 1.7 2002/07/13 20:28:35 dgp Exp $
+# RCS: @(#) $Id: textIndex.test,v 1.7.2.1 2005/05/13 13:48:21 vincentdarley Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -667,6 +667,17 @@ test testIndex-16.2 {TkTextPrintIndex} {
catch {destroy $t}
} 0
+test textIndex-23.1 {text paragraph start} {
+ pack [text .t2]
+ .t2 insert end " Text"
+ set res 2.0
+ for {set i 0} {$i < 2} {incr i} {
+ lappend res [::tk::TextPrevPara .t2 [lindex $res end]]
+ }
+ destroy .t2
+ set res
+} {2.0 1.1 1.1}
+
# cleanup
rename textimage {}
catch {destroy .t}