Tk Source Code

Check-in [84a90c5b]
Login

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

Overview
Comment:Fixed test of index being at start of both a logical line and a display line in TkTextFindDisplayLineEnd
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | text-elided
Files: files | file ages | folders
SHA1: 84a90c5bef4b8708d01b2c1aaec3510f8eeb6eb5
User & Date: fvogel 2014-12-21 20:54:05
Context
2014-12-23
11:09
Cherrypicked bug fix for Bug [c199ef90a6] - Wrong index returned by @x,y with elided lines at end of text check-in: 00298a1d user: fvogel tags: text-elided
2014-12-21
20:54
Fixed test of index being at start of both a logical line and a display line in TkTextFindDisplayLineEnd check-in: 84a90c5b user: fvogel tags: text-elided
2014-12-20
13:42
Fixed comment check-in: 9bb41fc3 user: fvogel tags: text-elided
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTextDisp.c.

3379
3380
3381
3382
3383
3384
3385


3386
3387
3388
3389
3390
3391
3392
3393
3394
    TkTextIndex *indexPtr,	/* Index we will adjust to the display line
				 * start or end. */
    int end,			/* 0 = start, 1 = end. */
    int *xOffset)		/* NULL, or used to store the x-pixel offset
				 * of the original index within its display
				 * line. */
{


    if (!end && indexPtr->byteIndex == 0
            && !TkTextIsElided(textPtr, indexPtr, NULL)) {
	/*
	 * Nothing to do.
	 */

	if (xOffset != NULL) {
	    *xOffset = 0;
	}







>
>

|







3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
    TkTextIndex *indexPtr,	/* Index we will adjust to the display line
				 * start or end. */
    int end,			/* 0 = start, 1 = end. */
    int *xOffset)		/* NULL, or used to store the x-pixel offset
				 * of the original index within its display
				 * line. */
{
    TkTextIndex indexPtr2;
    TkTextIndexBackBytes(textPtr, indexPtr, 1, &indexPtr2);
    if (!end && indexPtr->byteIndex == 0
            && !TkTextIsElided(textPtr, &indexPtr2, NULL)) {
	/*
	 * Nothing to do.
	 */

	if (xOffset != NULL) {
	    *xOffset = 0;
	}

Changes to tests/textDisp.test.

2085
2086
2087
2088
2089
2090
2091


2092
2093
2094
2095
2096
2097
2098
2099
      [.t count -xpixels 6.1 6.2] \
      [.t count -xpixels 6.1 6.0] \
      [.t count -xpixels 6.0 7.0] \
      [.t count -xpixels 6.1 7.1] \
      [.t count -xpixels 15.0 20.15] \
      [.t count -xpixels 20.15 20.16] \
      [.t count -xpixels 20.16 20.15]


} [list 0 0 0 0 0 0 0 0 $fixedWidth -$fixedWidth]
test textDisp-16.42 {TkTextYviewCmd procedure with indices in elided lines} {
    .t configure -wrap none
    .t delete 1.0 end
    for {set i 1} {$i < 100} {incr i} {
        .t insert end [string repeat "Line $i" 20]
        .t insert end "\n"
    }







>
>
|







2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
      [.t count -xpixels 6.1 6.2] \
      [.t count -xpixels 6.1 6.0] \
      [.t count -xpixels 6.0 7.0] \
      [.t count -xpixels 6.1 7.1] \
      [.t count -xpixels 15.0 20.15] \
      [.t count -xpixels 20.15 20.16] \
      [.t count -xpixels 20.16 20.15]
    .t tag remove hidden 20.0 20.15
    lappend res [expr {[.t count -xpixels 5.0 20.0] != 0}]
} [list 0 0 0 0 0 0 0 0 $fixedWidth -$fixedWidth 1]
test textDisp-16.42 {TkTextYviewCmd procedure with indices in elided lines} {
    .t configure -wrap none
    .t delete 1.0 end
    for {set i 1} {$i < 100} {incr i} {
        .t insert end [string repeat "Line $i" 20]
        .t insert end "\n"
    }