summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2014-12-29 16:27:07 (GMT)
committerfvogel <fvogelnew1@free.fr>2014-12-29 16:27:07 (GMT)
commitc5ab06677bacc32bf7e375716ab3f9b1df00be2e (patch)
tree1739a8b7fc163441e48d41ee23057515858ee3d9
parent3c2b8c528158a93d619459fb955cfb489b11b705 (diff)
downloadtk-c5ab06677bacc32bf7e375716ab3f9b1df00be2e.zip
tk-c5ab06677bacc32bf7e375716ab3f9b1df00be2e.tar.gz
tk-c5ab06677bacc32bf7e375716ab3f9b1df00be2e.tar.bz2
CalculateDisplayLineHeight checks, in debug mode, that the index it receives really is at the beginning of a display line.
-rw-r--r--generic/tkTextDisp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 4d9d042..a63c9bc 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3537,6 +3537,27 @@ CalculateDisplayLineHeight(
DLine *dlPtr;
int pixelHeight;
+ if (tkTextDebug) {
+ int oldtkTextDebug = tkTextDebug;
+ /*
+ * Check that the indexPtr we are given really is at the start of a
+ * display line. The gymnastics with tkTextDebug is to prevent
+ * failure of a test suite test, that checks that lines are rendered
+ * exactly once. TkTextFindDisplayLineEnd is used here for checking
+ * indexPtr but it calls LayoutDLine/FreeDLine which makes the
+ * counting wrong. The debug mode shall threfore be switched off when
+ * calling TkTextFindDisplayLineEnd.
+ */
+
+ TkTextIndex indexPtr2 = *indexPtr;
+ tkTextDebug = 0;
+ TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 0, NULL);
+ tkTextDebug = oldtkTextDebug;
+ if (TkTextIndexCmp(&indexPtr2,indexPtr) != 0) {
+ Tcl_Panic("CalculateDisplayLineHeight called with bad indexPtr");
+ }
+ }
+
/*
* Special case for artificial last line. May be better to move this
* inside LayoutDLine.