Posted to tcl by emiliano at Tue Dec 04 15:50:17 GMT 2012view pretty
Index: generic/tkTextIndex.c ================================================================== --- generic/tkTextIndex.c +++ generic/tkTextIndex.c @@ -758,18 +758,33 @@ sharedPtr = textPtr->sharedTextPtr; } /* *--------------------------------------------------------------------- - * Stage 1: check to see if the index consists of nothing but a mark name. + * Stage 1: check to see if the index consists of nothing but a mark name, + * an embedded window name or an image name. * We do this check now even though it's also done later, in order to - * allow mark names that include funny characters such as spaces or "+1c". + * allow mark names, embedded window names or image names that include + * funny characters such as spaces or "+1c". *--------------------------------------------------------------------- */ - if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) { - goto done; + if (textPtr != NULL) { + /* + * If textPtr is NULL, we have been called by the undo code + * with a numeric index of the form line.char + * so we skip these tests here + */ + if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) { + goto done; + } + if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) { + goto done; + } + if (TkTextImageIndex(textPtr, string, indexPtr) != 0) { + goto done; + } } /* *------------------------------------------------ * Stage 2: start again by parsing the base index. Index: generic/tkTextMark.c ================================================================== --- generic/tkTextMark.c +++ generic/tkTextMark.c @@ -435,14 +435,10 @@ { TkTextSegment *segPtr; TkTextIndex index; int start, end; - if (textPtr == NULL) { - return TCL_ERROR; - } - if (!strcmp(name, "insert")) { segPtr = textPtr->insertMarkPtr; } else if (!strcmp(name, "current")) { segPtr = textPtr->currentMarkPtr; } else {