summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkText.c50
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextDisp.c24
-rw-r--r--tests/text.test42
-rw-r--r--tests/textDisp.test20
5 files changed, 69 insertions, 69 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 15c6e73..9047911 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -689,16 +689,16 @@ TextWidgetObjCmd(
static const char *optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
"dlineinfo", "dump", "edit", "get", "image", "index", "insert",
- "mark", "peer", "pendingyupdate", "replace", "scan", "search",
- "see", "tag", "window", "xview", "yupdate", "yview", NULL
+ "mark", "peer", "pendingsync", "replace", "scan", "search",
+ "see", "sync", "tag", "window", "xview", "yview", NULL
};
enum options {
TEXT_BBOX, TEXT_CGET, TEXT_COMPARE, TEXT_CONFIGURE, TEXT_COUNT,
TEXT_DEBUG, TEXT_DELETE, TEXT_DLINEINFO, TEXT_DUMP, TEXT_EDIT,
TEXT_GET, TEXT_IMAGE, TEXT_INDEX, TEXT_INSERT, TEXT_MARK,
- TEXT_PEER, TEXT_PENDINGYUPDATE, TEXT_REPLACE, TEXT_SCAN,
- TEXT_SEARCH, TEXT_SEE, TEXT_TAG, TEXT_WINDOW, TEXT_XVIEW,
- TEXT_YUPDATE, TEXT_YVIEW
+ TEXT_PEER, TEXT_PENDINGSYNC, TEXT_REPLACE, TEXT_SCAN,
+ TEXT_SEARCH, TEXT_SEE, TEXT_SYNC, TEXT_TAG, TEXT_WINDOW,
+ TEXT_XVIEW, TEXT_YVIEW
};
if (objc < 2) {
@@ -1373,7 +1373,7 @@ TextWidgetObjCmd(
case TEXT_PEER:
result = TextPeerCmd(textPtr, interp, objc, objv);
break;
- case TEXT_PENDINGYUPDATE: {
+ case TEXT_PENDINGSYNC: {
int number;
if (objc != 2) {
@@ -1381,7 +1381,7 @@ TextWidgetObjCmd(
result = TCL_ERROR;
goto done;
}
- number = TkTextPendingyupdate(textPtr);
+ number = TkTextPendingsync(textPtr);
Tcl_SetObjResult(interp, Tcl_NewIntObj(number));
break;
}
@@ -1507,26 +1507,26 @@ TextWidgetObjCmd(
case TEXT_XVIEW:
result = TkTextXviewCmd(textPtr, interp, objc, objv);
break;
- case TEXT_YUPDATE: {
+ case TEXT_SYNC: {
if (objc == 4) {
- Tcl_Obj *cmd = objv[3];
- const char *option = Tcl_GetString(objv[2]);
- if (strncmp(option, "-command", objv[2]->length)) {
- Tcl_AppendResult(interp, "wrong option \"", option, "\": should be \"-command\"", NULL);
- result = TCL_ERROR;
- goto done;
- }
- Tcl_IncrRefCount(cmd);
- if (TkTextPendingyupdate(textPtr)) {
- if (textPtr->afterSyncCmd) {
- Tcl_DecrRefCount(textPtr->afterSyncCmd);
- }
- textPtr->afterSyncCmd = cmd;
- } else {
- result = Tcl_EvalObjEx(interp, cmd, TCL_EVAL_GLOBAL);
- Tcl_DecrRefCount(cmd);
+ Tcl_Obj *cmd = objv[3];
+ const char *option = Tcl_GetString(objv[2]);
+ if (strncmp(option, "-command", objv[2]->length)) {
+ Tcl_AppendResult(interp, "wrong option \"", option, "\": should be \"-command\"", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
+ Tcl_IncrRefCount(cmd);
+ if (TkTextPendingsync(textPtr)) {
+ if (textPtr->afterSyncCmd) {
+ Tcl_DecrRefCount(textPtr->afterSyncCmd);
}
- break;
+ textPtr->afterSyncCmd = cmd;
+ } else {
+ result = Tcl_EvalObjEx(interp, cmd, TCL_EVAL_GLOBAL);
+ Tcl_DecrRefCount(cmd);
+ }
+ break;
} else if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, "?-command command?");
result = TCL_ERROR;
diff --git a/generic/tkText.h b/generic/tkText.h
index 2aa8d59..1c4be68 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 TkTextPendingyupdate(TkText *textPtr);
+MODULE_SCOPE int 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 a8a8f85..3cee288 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -590,7 +590,7 @@ static int TextGetScrollInfoObj(Tcl_Interp *interp,
Tcl_Obj *CONST objv[], double *dblPtr,
int *intPtr);
static void AsyncUpdateLineMetrics(ClientData clientData);
-static void GenerateTextLineHeightsInvalidEvent(TkText *textPtr);
+static void GenerateWidgetViewSyncEvent(TkText *textPtr);
static void AsyncUpdateYScrollbar(ClientData clientData);
static int IsStartOfNotMergedLine(TkText *textPtr,
CONST TkTextIndex *indexPtr);
@@ -2930,7 +2930,7 @@ AsyncUpdateLineMetrics(
LOG("tk_textInvalidateLine", buffer);
}
- GenerateTextLineHeightsInvalidEvent(textPtr);
+ GenerateWidgetViewSyncEvent(textPtr);
/*
* If we're not in the middle of a long-line calculation (metricEpoch==-1)
@@ -2942,7 +2942,7 @@ AsyncUpdateLineMetrics(
/*
* We have looped over all lines, so we're done. We must release our
* refCount on the widget (the timer token was already set to NULL
- * above). If there is a registered command, run that first.
+ * above). If there is a registered aftersync command, run that first.
*/
if (textPtr->afterSyncCmd != NULL) {
@@ -2951,7 +2951,7 @@ AsyncUpdateLineMetrics(
code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL);
if (code != TCL_OK && code != TCL_CONTINUE
&& code != TCL_BREAK) {
- Tcl_AddErrorInfo(textPtr->interp, "\n (text yupdate)");
+ Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
Tcl_BackgroundError(textPtr->interp);
}
Tcl_Release((ClientData)textPtr->interp);
@@ -2978,12 +2978,12 @@ AsyncUpdateLineMetrics(
/*
*----------------------------------------------------------------------
*
- * GenerateTextLineHeightsInvalidEvent --
+ * GenerateWidgetViewSyncEvent --
*
- * Send the <<TextLineHeightsInvalid>> event related to the text widget
+ * Send the <<WidgetViewSync>> event related to the text widget
* line metrics asynchronous update.
* This is equivalent to:
- * event generate $textWidget <<TextLineHeightsInvalid>> -detail $N
+ * event generate $textWidget <<WidgetViewSync>> -detail $N
* where $N is the number of lines for which the height is outdated.
*
* Results:
@@ -2996,7 +2996,7 @@ AsyncUpdateLineMetrics(
*/
static void
-GenerateTextLineHeightsInvalidEvent(
+GenerateWidgetViewSyncEvent(
TkText *textPtr) /* Information about text widget. */
{
union {XEvent general; XVirtualEvent virtual;} event;
@@ -3007,8 +3007,8 @@ GenerateTextLineHeightsInvalidEvent(
event.general.xany.send_event = False;
event.general.xany.window = Tk_WindowId(textPtr->tkwin);
event.general.xany.display = Tk_Display(textPtr->tkwin);
- event.virtual.name = Tk_GetUid("TextLineHeightsInvalid");
- event.virtual.user_data = Tcl_NewIntObj(TkTextPendingyupdate(textPtr));
+ event.virtual.name = Tk_GetUid("WidgetViewSync");
+ event.virtual.user_data = Tcl_NewIntObj(TkTextPendingsync(textPtr));
Tk_HandleEvent(&event.general);
}
@@ -6089,7 +6089,7 @@ TkTextYviewCmd(
/*
*--------------------------------------------------------------
*
- * TkTextPendingyupdate --
+ * TkTextPendingsync --
*
* This function computes how many lines are not up-to-date regarding
* asynchronous height calculations.
@@ -6105,7 +6105,7 @@ TkTextYviewCmd(
*/
int
-TkTextPendingyupdate(
+TkTextPendingsync(
TkText *textPtr) /* Information about text widget. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
diff --git a/tests/text.test b/tests/text.test
index 7e754e2..3532546 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -153,7 +153,7 @@ test text-3.1 {TextWidgetCmd procedure, basics} {
} {1 {wrong # args: should be ".t option ?arg arg ...?"}}
test text-3.2 {TextWidgetCmd procedure} {
list [catch {.t gorp 1.0 z 1.2} msg] $msg
-} {1 {bad option "gorp": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingyupdate, replace, scan, search, see, tag, window, xview, yupdate, or yview}}
+} {1 {bad option "gorp": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingsync, replace, scan, search, see, sync, tag, window, xview, or yview}}
test text-4.1 {TextWidgetCmd procedure, "bbox" option} {
list [catch {.t bbox} msg] $msg
@@ -221,7 +221,7 @@ test text-6.13 {TextWidgetCmd procedure, "compare" option} {
} {1 {bad comparison operator "z": must be <, <=, ==, >=, >, or !=}}
test text-6.14 {TextWidgetCmd procedure, "compare" option} {
list [catch {.t co 1.0 z 1.2} msg] $msg
-} {1 {ambiguous option "co": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingyupdate, replace, scan, search, see, tag, window, xview, yupdate, or yview}}
+} {1 {ambiguous option "co": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingsync, replace, scan, search, see, sync, tag, window, xview, or yview}}
# "configure" option is already covered above
@@ -230,7 +230,7 @@ test text-7.1 {TextWidgetCmd procedure, "debug" option} {
} {1 {wrong # args: should be ".t debug boolean"}}
test text-7.2 {TextWidgetCmd procedure, "debug" option} {
list [catch {.t de 0 1} msg] $msg
-} {1 {ambiguous option "de": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingyupdate, replace, scan, search, see, tag, window, xview, yupdate, or yview}}
+} {1 {ambiguous option "de": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingsync, replace, scan, search, see, sync, tag, window, xview, or yview}}
test text-7.3 {TextWidgetCmd procedure, "debug" option} {
.t debug true
.t deb
@@ -901,7 +901,7 @@ test text-10.2 {TextWidgetCmd procedure, "index" option} {
} {1 {wrong # args: should be ".t index index"}}
test text-10.3 {TextWidgetCmd procedure, "index" option} {
list [catch {.t in a b} msg] $msg
-} {1 {ambiguous option "in": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingyupdate, replace, scan, search, see, tag, window, xview, yupdate, or yview}}
+} {1 {ambiguous option "in": must be bbox, cget, compare, configure, count, debug, delete, dlineinfo, dump, edit, get, image, index, insert, mark, peer, pendingsync, replace, scan, search, see, sync, tag, window, xview, or yview}}
test text-10.4 {TextWidgetCmd procedure, "index" option} {
list [catch {.t index @xyz} msg] $msg
} {1 {bad text index "@xyz"}}
@@ -960,12 +960,12 @@ test text-11.10 {TextWidgetCmd procedure, "insert" option} {
list [.t get 1.0 1.end] [.t tag ranges bold] [.t tag ranges silly]
} {{First second} {1.0 1.5} {1.5 1.12}}
-test text-11a.1 {TextWidgetCmd procedure, "yupdate" option} {
+test text-11a.1 {TextWidgetCmd procedure, "sync" option} {
destroy .yt
text .yt
- list [catch {.yt yupdate mytext} msg] $msg
-} {1 {wrong # args: should be ".yt yupdate"}}
-test text-11a.2 {TextWidgetCmd procedure, "yupdate" option} {
+ list [catch {.yt sync mytext} msg] $msg
+} {1 {wrong # args: should be ".yt sync ?-command command?"}}
+test text-11a.2 {TextWidgetCmd procedure, "sync" option} {
destroy .top.yt .top
toplevel .top
pack [text .top.yt]
@@ -976,7 +976,7 @@ test text-11a.2 {TextWidgetCmd procedure, "yupdate" option} {
.top.yt insert 1.0 $content
# wait for end of line metrics calculation to get correct $fraction1
# as a reference
- .top.yt yupdate
+ .top.yt sync
.top.yt yview moveto 1
set fraction1 [lindex [.top.yt yview] 0]
set res [expr {$fraction1 > 0}]
@@ -989,17 +989,17 @@ test text-11a.2 {TextWidgetCmd procedure, "yupdate" option} {
# second case: wait for completion of line metrics calculation
.top.yt delete 1.0 end
.top.yt insert 1.0 $content
- .top.yt yupdate
+ .top.yt sync
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
} {1 0 1}
-test text-11a.11 {TextWidgetCmd procedure, "pendingyupdate" option} {
+test text-11a.11 {TextWidgetCmd procedure, "pendingsync" option} {
destroy .yt
text .yt
- list [catch {.yt pendingyupdate mytext} msg] $msg
-} {1 {wrong # args: should be ".yt pendingyupdate"}}
-test text-11a.12 {TextWidgetCmd procedure, "pendingyupdate" option} {
+ list [catch {.yt pendingsync mytext} msg] $msg
+} {1 {wrong # args: should be ".yt pendingsync"}}
+test text-11a.12 {TextWidgetCmd procedure, "pendingsync" option} {
destroy .top.yt .top
toplevel .top
pack [text .top.yt]
@@ -1011,21 +1011,21 @@ test text-11a.12 {TextWidgetCmd procedure, "pendingyupdate" option} {
update
# wait for end of line metrics calculation to get correct $fraction1
# as a reference
- while {[.top.yt pendingyupdate]} {update}
+ while {[.top.yt pendingsync]} {update}
.top.yt yview moveto 1
set fraction1 [lindex [.top.yt yview] 0]
set res [expr {$fraction1 > 0}]
.top.yt delete 1.0 end
.top.yt insert 1.0 $content
# ensure the test is relevant
- lappend res [expr {[.top.yt pendingyupdate] > 0}]
+ lappend res [expr {[.top.yt pendingsync] > 0}]
# asynchronously wait for completion of line metrics calculation
- while {[.top.yt pendingyupdate]} {update}
+ while {[.top.yt pendingsync]} {update}
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
} {1 1 1}
-test text-11a.21 {"<<TextLineHeightsInvalid>>" event} {
+test text-11a.21 {"<<WidgetViewSync>>" event} {
destroy .top.yt .top
toplevel .top
pack [text .top.yt]
@@ -1035,10 +1035,10 @@ test text-11a.21 {"<<TextLineHeightsInvalid>>" event} {
}
.top.yt insert 1.0 $content
update
- bind .top.yt <<TextLineHeightsInvalid>> { if {%d == 0} {set yud(%W) 1} }
+ bind .top.yt <<WidgetViewSync>> { if {%d == 0} {set yud(%W) 1} }
# wait for end of line metrics calculation to get correct $fraction1
# as a reference
- if {[.top.yt pendingyupdate]} {vwait yud(.top.yt)}
+ if {[.top.yt pendingsync]} {vwait yud(.top.yt)}
.top.yt yview moveto 1
set fraction1 [lindex [.top.yt yview] 0]
set res [expr {$fraction1 > 0}]
@@ -1047,7 +1047,7 @@ test text-11a.21 {"<<TextLineHeightsInvalid>>" event} {
# synchronously wait for completion of line metrics calculation
# and ensure the test is relevant
set waited 0
- if {[.top.yt pendingyupdate]} {set waited 1 ; vwait yud(.top.yt)}
+ if {[.top.yt pendingsync]} {set waited 1 ; vwait yud(.top.yt)}
lappend res $waited
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 133fcf5..80bdb9d 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -4175,9 +4175,9 @@ test textDisp-34.1 {Line heights recalculation problem: bug 2677890} -setup {
set ge [winfo geometry .]
scan $ge "%dx%d+%d+%d" width height left top
update
- .t1 yupdate
+ .t1 sync
set negative 0
- bind .t1 <<TextLineHeightsInvalid>> { if {%d < 0} {set negative 1} }
+ bind .t1 <<WidgetViewSync>> { if {%d < 0} {set negative 1} }
# Without the fix for bug 2677890, changing the width of the toplevel
# will launch recomputation of the line heights, but will produce negative
# number of still remaining outdated lines, which is obviously wrong.
@@ -4185,33 +4185,33 @@ test textDisp-34.1 {Line heights recalculation problem: bug 2677890} -setup {
# i.e. to check that the fix for this bug really is still in.
wm geometry . "[expr {$width * 2}]x$height+$left+$top"
update
- .t1 yupdate
+ .t1 sync
set negative
} -cleanup {
destroy .t1
} -result {0}
-test textDisp-34.2 {text yupdate syntax} -body {
+test textDisp-34.2 {text sync syntax} -body {
} -body {
pack [text .t1] -expand 1 -fill both
- .t1 yupdate foo
+ .t1 sync foo
} -cleanup {
destroy .t1
-} -returnCodes 1 -result {wrong # args: should be ".t1 yupdate ?-command command?"}
+} -returnCodes 1 -result {wrong # args: should be ".t1 sync ?-command command?"}
-test textDisp-34.3 {text yupdate syntax} -body {
+test textDisp-34.3 {text sync syntax} -body {
} -body {
pack [text .t1] -expand 1 -fill both
- .t1 yupdate -comx foo
+ .t1 sync -comx foo
} -cleanup {
destroy .t1
} -returnCodes 1 -result {wrong option "-comx": should be "-command"}
-test textDisp-34.4 {text yupdate syntax} -body {
+test textDisp-34.4 {text sync syntax} -body {
} -body {
set ::x 0
pack [text .t1] -expand 1 -fill both
- .t1 yupdate -comm [list set ::x 1]
+ .t1 sync -comm [list set ::x 1]
set ::x
} -cleanup {
destroy .t1