summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorfvogelnew1@free.fr <fvogel>2014-12-29 16:27:07 (GMT)
committerfvogelnew1@free.fr <fvogel>2014-12-29 16:27:07 (GMT)
commit42a07e838bd52d2daa3e69876f001ae6310343aa (patch)
treea0268d899db6c42c808364cc7e4ba639c4b799c6 /generic
parent39f9299231fa41108b01444263ee4389cbae424e (diff)
downloadtk-42a07e838bd52d2daa3e69876f001ae6310343aa.zip
tk-42a07e838bd52d2daa3e69876f001ae6310343aa.tar.gz
tk-42a07e838bd52d2daa3e69876f001ae6310343aa.tar.bz2
CalculateDisplayLineHeight checks, in debug mode, that the index it receives really is at the beginning of a display line.
Diffstat (limited to 'generic')
-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.