summaryrefslogtreecommitdiffstats
path: root/generic/tkTextWind.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-04-18 11:45:48 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-04-18 11:45:48 (GMT)
commitc7001ef810392979672d06f30e272c43a679cb01 (patch)
treef45bfd3a438a6b080d7e0155f3ff33efec504e40 /generic/tkTextWind.c
parente697be6fa9901a1479c2b0de7b064d3b8b27b72c (diff)
parent4f342cf8461171eafee55086646adde29dd8631c (diff)
downloadtk-c7001ef810392979672d06f30e272c43a679cb01.zip
tk-c7001ef810392979672d06f30e272c43a679cb01.tar.gz
tk-c7001ef810392979672d06f30e272c43a679cb01.tar.bz2
Fix [34db75c0ac]: Text peer widget error on Down arrow key when passed -endline line. Also, propagate the fix for [1630271fff] from marks to embedded images and windows.
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r--generic/tkTextWind.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index adf1ad5..a43293f 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1320,9 +1320,9 @@ EmbWinDelayedUnmap(
* index corresponding to the window's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded window by the given name
- * in the text widget, 0 otherwise. If the window exists, *indexPtr is
- * filled in with its index.
+ * The return value is TCL_OK if there is an embedded window by the given
+ * name in the text widget, TCL_ERROR otherwise. If the window exists,
+ * *indexPtr is filled in with its index.
*
* Side effects:
* None.
@@ -1340,19 +1340,30 @@ TkTextWindowIndex(
TkTextSegment *ewPtr;
if (textPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name);
if (hPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr);
- return 1;
+
+ /*
+ * If indexPtr refers to somewhere outside the -startline/-endline
+ * range limits of the widget, error out since the window indeed is not
+ * reachable from this text widget (it may be reachable from a peer).
+ */
+
+ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
}
/*