Posted to tcl by emiliano at Tue Dec 04 15:50:17 GMT 2012view raw

  1. Index: generic/tkTextIndex.c
  2. ==================================================================
  3. --- generic/tkTextIndex.c
  4. +++ generic/tkTextIndex.c
  5. @@ -758,18 +758,33 @@
  6. sharedPtr = textPtr->sharedTextPtr;
  7. }
  8.  
  9. /*
  10. *---------------------------------------------------------------------
  11. - * Stage 1: check to see if the index consists of nothing but a mark name.
  12. + * Stage 1: check to see if the index consists of nothing but a mark name,
  13. + * an embedded window name or an image name.
  14. * We do this check now even though it's also done later, in order to
  15. - * allow mark names that include funny characters such as spaces or "+1c".
  16. + * allow mark names, embedded window names or image names that include
  17. + * funny characters such as spaces or "+1c".
  18. *---------------------------------------------------------------------
  19. */
  20.  
  21. - if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
  22. - goto done;
  23. + if (textPtr != NULL) {
  24. + /*
  25. + * If textPtr is NULL, we have been called by the undo code
  26. + * with a numeric index of the form line.char
  27. + * so we skip these tests here
  28. + */
  29. + if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
  30. + goto done;
  31. + }
  32. + if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) {
  33. + goto done;
  34. + }
  35. + if (TkTextImageIndex(textPtr, string, indexPtr) != 0) {
  36. + goto done;
  37. + }
  38. }
  39.  
  40. /*
  41. *------------------------------------------------
  42. * Stage 2: start again by parsing the base index.
  43.  
  44. Index: generic/tkTextMark.c
  45. ==================================================================
  46. --- generic/tkTextMark.c
  47. +++ generic/tkTextMark.c
  48. @@ -435,14 +435,10 @@
  49. {
  50. TkTextSegment *segPtr;
  51. TkTextIndex index;
  52. int start, end;
  53.  
  54. - if (textPtr == NULL) {
  55. - return TCL_ERROR;
  56. - }
  57. -
  58. if (!strcmp(name, "insert")) {
  59. segPtr = textPtr->insertMarkPtr;
  60. } else if (!strcmp(name, "current")) {
  61. segPtr = textPtr->currentMarkPtr;
  62. } else {
  63.  
  64.