From 47fa51915781b8ceb0ad65f72b06b6d4814dbde7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 8 Feb 2016 20:13:20 +0000 Subject: More comments in FindDLine, with slightly optimized code to achieve the same functionality. --- generic/tkTextDisp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index c5ad36b..d45ac73 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -6618,17 +6618,25 @@ FindDLine( /* * We're past the last display line, either because the desired * index lies past the visible text, or because the desired index - * is on the last display line showing the last logical line. + * is on the last display line. */ indexPtr2 = dlPtrPrev->index; TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount, &indexPtr2); if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) { + /* + * The desired index is on the last display line. + * --> return this display line. + */ dlPtr = dlPtrPrev; - break; } else { - return NULL; + /* + * The desired index is past the visible text. There is no + * display line displaying something at the desired index + * --> return NULL. + */ } + break; } if (TkTextIndexCmp(&dlPtr->index,indexPtr) > 0) { dlPtr = dlPtrPrev; -- cgit v0.12