diff options
-rw-r--r-- | generic/tkTextDisp.c | 34 | ||||
-rw-r--r-- | tests/textWind.test | 6 |
2 files changed, 22 insertions, 18 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index e6991da..c3ea9e0 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -6446,8 +6446,6 @@ FindDLine( < TkBTreeLinesTo(NULL, dlPtr->index.linePtr)) { /* * The first display line is already past the desired line. - * FV: Some concern here as to whether we should rather return - * NULL here. */ return dlPtr; @@ -6456,7 +6454,7 @@ FindDLine( /* * The display line containing the desired index is such that the index * of the first character of this display line is at or before the - * desired index, and the index onf the first character of the next + * desired index, and the index of the first character of the next * display line is after the desired index. */ @@ -6464,24 +6462,24 @@ FindDLine( dlPtrPrev = dlPtr; dlPtr = dlPtr->nextPtr; if (dlPtr == NULL) { - /* - * 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. - */ - indexPtr2 = dlPtrPrev->index; - TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 1, NULL); - if (TkTextIndexCmp(&indexPtr2,indexPtr) >= 0) { - dlPtr = dlPtrPrev; - break; - } else { - return NULL; - } - } + /* + * 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. + */ + indexPtr2 = dlPtrPrev->index; + TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 1, NULL); + if (TkTextIndexCmp(&indexPtr2,indexPtr) >= 0) { + dlPtr = dlPtrPrev; + break; + } else { + return NULL; + } + } if (TkTextIndexCmp(&dlPtr->index,indexPtr) > 0) { dlPtr = dlPtrPrev; break; - } + } } return dlPtr; diff --git a/tests/textWind.test b/tests/textWind.test index 79dca50..23a9e71 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -461,6 +461,7 @@ test textWind-10.4.1 {EmbWinLayoutProc procedure, error in creating window} {tex .t delete 1.0 end .t insert 1.0 "Some sample text" catch {destroy .t.f} + update .t window create 1.5 -create { frame .t.f frame .t.f.f -width 10 -height 20 -bg $color @@ -473,6 +474,7 @@ catch {destroy .t.f} test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} {textfonts} { .t delete 1.0 end .t insert 1.0 "Some sample text" + update .t window create 1.5 -create { concat .t } @@ -484,6 +486,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} {textf .t delete 1.0 end .t insert 1.0 "Some sample text" catch {destroy .t2} + update .t window create 1.5 -create { toplevel .t2 -width 100 -height 150 wm geom .t2 +0+0 @@ -497,6 +500,7 @@ test textWind-10.6.1 {EmbWinLayoutProc procedure, error in creating window} { .t delete 1.0 end .t insert 1.0 "Some sample text" catch {destroy .t2} + update .t window create 1.5 -create { toplevel .t2 -width 100 -height 150 wm geom .t2 +0+0 @@ -595,6 +599,8 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} { .t insert 1.0 "Some sample text" pack forget .t place .t -x 30 -y 50 + catch {destroy .t.f} + update frame .t.f -width 30 -height 20 -bg $color .t window create 1.12 -window .t.f update |