Tk Source Code

Check-in [22d3368e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3588824]: bug in image index handling for weird image names
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 22d3368e71cab5f668519e2542f0863360ddd0ca
User & Date: dgp 2012-12-04 16:37:18
Context
2012-12-06
14:00
Force the use of the correct internal function for parsing hex colors rather than leaving it to the vagaries of the system library (buggy on some versions of MinGW apparently). check-in: babb4042 user: dkf tags: core-8-5-branch
13:26
possible fix for bug 3592736 (with some formatting improvements from dkf) Closed-Leaf check-in: aefb8918 user: jan.nijtmans tags: bug-3592736
2012-12-04
17:02
[Bug 3588824]: bug in image index handling for weird image names check-in: b5918b5b user: dgp tags: trunk
16:37
[Bug 3588824]: bug in image index handling for weird image names check-in: 22d3368e user: dgp tags: core-8-5-branch
2012-12-03
01:24
Fixed commit date check-in: 2f0eb00f user: fvogel tags: core-8-4-branch
2012-12-02
22:27
merge-mark check-in: 82edd3d8 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-11-13  Jan Nijtmans  <[email protected]>

	* win/tkWinTest.c: [Bug 3585396]: winDialog.test requires user
	* tests/winDialog.test: interaction. Renumber test-cases as in
	Tk 8.6, and convert various to tcltest-2 style.

2012-11-09  Don Porter  <[email protected]>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-12-04  Francois Vogel  <[email protected]>

   * generic/tkTextIndex.c: [Bug 3588824]: bug in image index handling
   * tests/textIndex.test:  for weird image names

2012-11-13  Jan Nijtmans  <[email protected]>

	* win/tkWinTest.c: [Bug 3585396]: winDialog.test requires user
	* tests/winDialog.test: interaction. Renumber test-cases as in
	Tk 8.6, and convert various to tcltest-2 style.

2012-11-09  Don Porter  <[email protected]>

Changes to generic/tkTextImage.c.

774
775
776
777
778
779
780




781
782
783
784
785
786
787
TkTextImageIndex(
    TkText *textPtr,		/* Text widget containing image. */
    const char *name,		/* Name of image. */
    TkTextIndex *indexPtr)	/* Index information gets stored here. */
{
    Tcl_HashEntry *hPtr;
    TkTextSegment *eiPtr;





    hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name);
    if (hPtr == NULL) {
	return 0;
    }
    eiPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
    indexPtr->tree = textPtr->sharedTextPtr->tree;







>
>
>
>







774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
TkTextImageIndex(
    TkText *textPtr,		/* Text widget containing image. */
    const char *name,		/* Name of image. */
    TkTextIndex *indexPtr)	/* Index information gets stored here. */
{
    Tcl_HashEntry *hPtr;
    TkTextSegment *eiPtr;

    if (textPtr == NULL) {
	return 0;
    }

    hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name);
    if (hPtr == NULL) {
	return 0;
    }
    eiPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
    indexPtr->tree = textPtr->sharedTextPtr->tree;

Changes to generic/tkTextIndex.c.

754
755
756
757
758
759
760
761

762

763
764
765
766
767
768
769








770
771
772
773
774
775
776

    if (sharedPtr == NULL) {
	sharedPtr = textPtr->sharedTextPtr;
    }

    /*
     *---------------------------------------------------------------------
     * Stage 1: check to see if the index consists of nothing but a mark 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".
     *---------------------------------------------------------------------
     */

    if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
	goto done;
    }









    /*
     *------------------------------------------------
     * Stage 2: start again by parsing the base index.
     *------------------------------------------------
     */








|
>
|
>
|






>
>
>
>
>
>
>
>







754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786

    if (sharedPtr == NULL) {
	sharedPtr = textPtr->sharedTextPtr;
    }

    /*
     *---------------------------------------------------------------------
     * Stage 1: check to see if the index consists of nothing but a mark
     * name, an embedded window or an embedded image.  We do this check
     * now even though it's also done later, in order to 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 (TkTextWindowIndex(textPtr, string, indexPtr) != 0) {
	return TCL_OK;
    }

    if (TkTextImageIndex(textPtr, string, indexPtr) != 0) {
	return TCL_OK;
    }

    /*
     *------------------------------------------------
     * Stage 2: start again by parsing the base index.
     *------------------------------------------------
     */

Changes to generic/tkTextWind.c.

1324
1325
1326
1327
1328
1329
1330




1331
1332
1333
1334
1335
1336
1337
TkTextWindowIndex(
    TkText *textPtr,		/* Text widget containing window. */
    const char *name,		/* Name of window. */
    TkTextIndex *indexPtr)	/* Index information gets stored here. */
{
    Tcl_HashEntry *hPtr;
    TkTextSegment *ewPtr;





    hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name);
    if (hPtr == NULL) {
	return 0;
    }

    ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);







>
>
>
>







1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
TkTextWindowIndex(
    TkText *textPtr,		/* Text widget containing window. */
    const char *name,		/* Name of window. */
    TkTextIndex *indexPtr)	/* Index information gets stored here. */
{
    Tcl_HashEntry *hPtr;
    TkTextSegment *ewPtr;

    if (textPtr == NULL) {
	return 0;
    }

    hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name);
    if (hPtr == NULL) {
	return 0;
    }

    ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);

Changes to tests/textIndex.test.

210
211
212
213
214
215
216





217
218
219

















220
221
222
223
224
225
226
.t tag add x 2.8 2.11
.t tag add x 6.0 6.2
set weirdTag "funny . +- 22.1\n\t{"
.t tag add $weirdTag 2.1  2.6
set weirdMark "asdf \n{-+ 66.2\t"
.t mark set $weirdMark 4.0
.t tag config y -relief raised





test textIndex-3.1 {TkTextGetIndex, weird mark names} {
    list [catch {.t index $weirdMark} msg] $msg
} {0 4.0}


















test textIndex-4.1 {TkTextGetIndex, tags} {
    list [catch {.t index x.first} msg] $msg
} {0 2.8}
test textIndex-4.2 {TkTextGetIndex, tags} {
    list [catch {.t index x.last} msg] $msg
} {0 6.2}







>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
.t tag add x 2.8 2.11
.t tag add x 6.0 6.2
set weirdTag "funny . +- 22.1\n\t{"
.t tag add $weirdTag 2.1  2.6
set weirdMark "asdf \n{-+ 66.2\t"
.t mark set $weirdMark 4.0
.t tag config y -relief raised
set weirdImage "foo-1"
.t image create 2.1 -image [image create photo $weirdImage]
set weirdEmbWin ".t.bar-1"
entry $weirdEmbWin
.t window create 3.1 -window $weirdEmbWin
test textIndex-3.1 {TkTextGetIndex, weird mark names} {
    list [catch {.t index $weirdMark} msg] $msg
} {0 4.0}
test textIndex-3.2 {TkTextGetIndex, weird mark names} knownBug {
    list [catch {.t index "$weirdMark -1char"} msg] $msg
} {0 4.0}
test textIndex-3.3 {TkTextGetIndex, weird embedded window names} {
    list [catch {.t index $weirdEmbWin} msg] $msg
} {0 3.1}
test textIndex-3.4 {TkTextGetIndex, weird embedded window names} knownBug {
    list [catch {.t index "$weirdEmbWin -1char"} msg] $msg
} {0 3.0}
test textIndex-3.5 {TkTextGetIndex, weird image names} {
    list [catch {.t index $weirdImage} msg] $msg
} {0 2.1}
test textIndex-3.6 {TkTextGetIndex, weird image names} knownBug {
    list [catch {.t index "$weirdImage -1char"} msg] $msg
} {0 2.0}
.t delete 3.1  ; # remove the weirdEmbWin
.t delete 2.1  ; # remove the weirdImage

test textIndex-4.1 {TkTextGetIndex, tags} {
    list [catch {.t index x.first} msg] $msg
} {0 2.8}
test textIndex-4.2 {TkTextGetIndex, tags} {
    list [catch {.t index x.last} msg] $msg
} {0 6.2}