summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-10-31 14:21:48 (GMT)
committervincentdarley <vincentdarley>2003-10-31 14:21:48 (GMT)
commit3e4b9ddf078d687679e15a6b5fc0c024884a1d9a (patch)
tree06535c94176e831d89c2632b0f0a94723bb55f9b
parent65d781267ff97522f0dbde3718a2f79f6cafeb14 (diff)
downloadtk-3e4b9ddf078d687679e15a6b5fc0c024884a1d9a.zip
tk-3e4b9ddf078d687679e15a6b5fc0c024884a1d9a.tar.gz
tk-3e4b9ddf078d687679e15a6b5fc0c024884a1d9a.tar.bz2
text widget bug fix
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkTextDisp.c13
-rw-r--r--tests/textDisp.test25
3 files changed, 41 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 64c143c..396c0c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,7 +26,12 @@
widget, the '-blockcursor' option, and in particular provides
correct, smooth pixel-based scrolling of the widget under all
circumstances. See the text.n man page for the complete new
- documentation.
+ documentation. This also fixes [Bug 559450], [Bug 778511],
+ [Bug 779174].
+
+ * generic/tkTextDisp.c
+ * tests/textDisp.test: tests and fix to the promptly
+ reported [Bug 833627]
2003-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 701fe96..7a97aa7 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextDisp.c,v 1.18 2003/10/31 09:02:10 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.19 2003/10/31 14:21:49 vincentdarley Exp $
*/
#include "tkPort.h"
@@ -5636,7 +5636,16 @@ DlineIndexOfX(textPtr, dlPtr, x, indexPtr)
*indexPtr = dlPtr->index;
x = x - dInfoPtr->x + dInfoPtr->curXPixelOffset;
- for (chunkPtr = dlPtr->chunkPtr; x >= (chunkPtr->x + chunkPtr->width);
+ chunkPtr = dlPtr->chunkPtr;
+
+ if (chunkPtr == NULL) {
+ /*
+ * This may occur if everything is elided
+ */
+ return;
+ }
+
+ for (; x >= (chunkPtr->x + chunkPtr->width);
indexPtr->byteIndex += chunkPtr->numBytes,
chunkPtr = chunkPtr->nextPtr) {
if (chunkPtr->nextPtr == NULL) {
diff --git a/tests/textDisp.test b/tests/textDisp.test
index da8659b..d1466ee 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: textDisp.test,v 1.10 2003/10/31 09:02:16 vincentdarley Exp $
+# RCS: @(#) $Id: textDisp.test,v 1.11 2003/10/31 14:21:49 vincentdarley Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -3224,6 +3224,29 @@ test textDisp-31.6 {line update index shifting} {
set res
} {190 220 135 105 190}
+test textDisp-32.0 {everything elided} {
+ # Must not crash
+ pack [text .tt]
+ .tt insert 0.0 HELLO
+ .tt tag configure HIDE -elide 1
+ .tt tag add HIDE 0.0 end
+ update ; update ; update ; update
+ destroy .tt
+} {}
+
+test textDisp-32.1 {everything elided} {
+ # Must not crash
+ pack [text .tt]
+ update
+ .tt insert 0.0 HELLO
+ update
+ .tt tag configure HIDE -elide 1
+ update
+ .tt tag add HIDE 0.0 end
+ update ; update ; update ; update
+ destroy .tt
+} {}
+
deleteWindows
option clear