summaryrefslogtreecommitdiffstats
path: root/generic/tkTextMark.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-22 16:12:27 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-22 16:12:27 (GMT)
commitb234fa21ff63b9be8fba12185f3f87a228bac3fc (patch)
treec1a26163a027491def8861f1e72772af90491085 /generic/tkTextMark.c
parent6a1b23bb279925e25b7611184ad2915ff5043d8b (diff)
parent33a724f6c44c1c2ab31597a064b552f3d49e1fbf (diff)
downloadtk-b234fa21ff63b9be8fba12185f3f87a228bac3fc.zip
tk-b234fa21ff63b9be8fba12185f3f87a228bac3fc.tar.gz
tk-b234fa21ff63b9be8fba12185f3f87a228bac3fc.tar.bz2
patch 3471873: mark next/prev with peer text widgets
Diffstat (limited to 'generic/tkTextMark.c')
-rw-r--r--generic/tkTextMark.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 1c08b4a..6117127 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -806,11 +806,17 @@ MarkFindNext(
Tcl_SetResult(interp, "current", TCL_STATIC);
} else if (segPtr == textPtr->insertMarkPtr) {
Tcl_SetResult(interp, "insert", TCL_STATIC);
- } else if (segPtr->body.mark.textPtr != textPtr) {
+ } else if (segPtr->body.mark.hPtr == NULL) {
/*
* Ignore widget-specific marks for the other widgets.
- */
-
+ * This is either an insert or a current mark
+ * (markPtr->body.mark.hPtr actually receives NULL
+ * for these marks in TkTextSetMark).
+ * The insert and current marks for textPtr having
+ * already been tested above, the current segment is
+ * an insert or current mark from a peer of textPtr,
+ * which we don't want to return.
+ */
continue;
} else {
Tcl_SetResult(interp,
@@ -893,7 +899,7 @@ MarkFindPrev(
while (1) {
/*
* segPtr points just past the first possible candidate, or at the
- * begining of the line.
+ * beginning of the line.
*/
for (prevPtr = NULL, seg2Ptr = index.linePtr->segPtr;
@@ -901,26 +907,43 @@ MarkFindPrev(
seg2Ptr = seg2Ptr->nextPtr) {
if (seg2Ptr->typePtr == &tkTextRightMarkType ||
seg2Ptr->typePtr == &tkTextLeftMarkType) {
+ if (seg2Ptr->body.mark.hPtr == NULL) {
+ if (seg2Ptr != textPtr->currentMarkPtr &&
+ seg2Ptr != textPtr->insertMarkPtr) {
+ /*
+ * This is an insert or current mark from a
+ * peer of textPtr.
+ */
+ continue;
+ }
+ }
prevPtr = seg2Ptr;
}
}
if (prevPtr != NULL) {
if (prevPtr == textPtr->currentMarkPtr) {
Tcl_SetResult(interp, "current", TCL_STATIC);
+ return TCL_OK;
} else if (prevPtr == textPtr->insertMarkPtr) {
Tcl_SetResult(interp, "insert", TCL_STATIC);
- } else if (prevPtr->body.mark.textPtr != textPtr) {
+ return TCL_OK;
+ } else if (prevPtr->body.mark.hPtr == NULL) {
/*
* Ignore widget-specific marks for the other widgets.
- */
-
- continue;
+ * This is either an insert or a current mark
+ * (markPtr->body.mark.hPtr actually receives NULL
+ * for these marks in TkTextSetMark).
+ * The insert and current marks for textPtr having
+ * already been tested above, the current segment is
+ * an insert or current mark from a peer of textPtr,
+ * which we don't want to return.
+ */
} else {
Tcl_SetResult(interp,
Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
prevPtr->body.mark.hPtr), TCL_STATIC);
+ return TCL_OK;
}
- return TCL_OK;
}
index.linePtr = TkBTreePreviousLine(textPtr, index.linePtr);
if (index.linePtr == NULL) {