summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-11-28 19:45:01 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-11-28 19:45:01 (GMT)
commit492a37c09443c512e4054acff1bd206ae5d4d501 (patch)
tree25422f71bf65b1db89584a001d6a949ee031bd41
parent95fd1a86a7bef3b6e0458a8a15041cdff62aa571 (diff)
downloadtk-492a37c09443c512e4054acff1bd206ae5d4d501.zip
tk-492a37c09443c512e4054acff1bd206ae5d4d501.tar.gz
tk-492a37c09443c512e4054acff1bd206ae5d4d501.tar.bz2
[.text pendingsync] returns a boolean
-rw-r--r--generic/tkText.c6
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextDisp.c13
-rw-r--r--tests/text.test2
4 files changed, 11 insertions, 12 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 62de1af..09e656f 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -1374,15 +1374,13 @@ TextWidgetObjCmd(
result = TextPeerCmd(textPtr, interp, objc, objv);
break;
case TEXT_PENDINGSYNC: {
- int number;
-
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
result = TCL_ERROR;
goto done;
}
- number = TkTextPendingsync(textPtr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(number));
+ Tcl_SetObjResult(interp,
+ Tcl_NewBooleanObj(TkTextPendingsync(textPtr)));
break;
}
case TEXT_REPLACE: {
diff --git a/generic/tkText.h b/generic/tkText.h
index 1c4be68..49ee479 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -1125,7 +1125,7 @@ MODULE_SCOPE int TkTextMarkNameToIndex(TkText *textPtr,
MODULE_SCOPE void TkTextMarkSegToIndex(TkText *textPtr,
TkTextSegment *markPtr, TkTextIndex *indexPtr);
MODULE_SCOPE void TkTextEventuallyRepick(TkText *textPtr);
-MODULE_SCOPE int TkTextPendingsync(TkText *textPtr);
+MODULE_SCOPE Bool TkTextPendingsync(TkText *textPtr);
MODULE_SCOPE void TkTextPickCurrent(TkText *textPtr, XEvent *eventPtr);
MODULE_SCOPE void TkTextPixelIndex(TkText *textPtr, int x, int y,
TkTextIndex *indexPtr, int *nearest);
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index d8a17a9..d214fa7 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6101,12 +6101,11 @@ TkTextYviewCmd(
*
* TkTextPendingsync --
*
- * This function computes how many lines are not up-to-date regarding
- * asynchronous height calculations.
+ * This function checks if any line heights are not up-to-date.
*
* Results:
- * Returns a positive integer corresponding to the number of lines for
- * which the height is outdated.
+ * Returns a boolean true if it is the case, or false if all line
+ * heights are up-to-date.
*
* Side effects:
* None.
@@ -6114,13 +6113,15 @@ TkTextYviewCmd(
*--------------------------------------------------------------
*/
-int
+Bool
TkTextPendingsync(
TkText *textPtr) /* Information about text widget. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- return (dInfoPtr->lastMetricUpdateLine - dInfoPtr->currentMetricUpdateLine);
+ return (
+ (dInfoPtr->lastMetricUpdateLine - dInfoPtr->currentMetricUpdateLine) ?
+ 1 : 0);
}
/*
diff --git a/tests/text.test b/tests/text.test
index dc44293..89dd12c 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1044,7 +1044,7 @@ test text-11a.12 {TextWidgetCmd procedure, "pendingsync" option} -setup {
.top.yt delete 1.0 end
.top.yt insert 1.0 $content
# ensure the test is relevant
- lappend res [expr {[.top.yt pendingsync] > 0}]
+ lappend res [.top.yt pendingsync]
# asynchronously wait for completion of line metrics calculation
while {[.top.yt pendingsync]} {update}
.top.yt yview moveto $fraction1