summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2014-12-03 23:16:02 (GMT)
committerfvogel <fvogelnew1@free.fr>2014-12-03 23:16:02 (GMT)
commit71455d5a91a1b922d393d253d98ff4fbdbac8b6b (patch)
tree75cdc5d3f64b4c1a5137aea4c9f758005f99a314
parent92c3e64dc6cd30fd0a261254be7bba659a3d5534 (diff)
downloadtk-71455d5a91a1b922d393d253d98ff4fbdbac8b6b.zip
tk-71455d5a91a1b922d393d253d98ff4fbdbac8b6b.tar.gz
tk-71455d5a91a1b922d393d253d98ff4fbdbac8b6b.tar.bz2
Checked dlineinfo caller of FindDLine, comments added
-rw-r--r--generic/tkTextDisp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index c3ea9e0..b9790db 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6972,6 +6972,15 @@ TkTextDLineInfo(
*/
dlPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, indexPtr);
+
+ /*
+ * Two cases shall be trapped here because the logic later really
+ * needs dlPtr to be the display line containing indexPtr:
+ * 1. if no display line contains the desired index (NULL dlPtr)
+ * 2. if indexPtr is before the first display line, in which case
+ * dlPtr currently points to the first display line
+ */
+
if ((dlPtr == NULL) || (TkTextIndexCmp(&dlPtr->index, indexPtr) > 0)) {
return -1;
}