Tk Source Code

Check-in [5423e10b]
Login

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

Overview
Comment:Fixed indentation in TkTextUpdateOneLine
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | text-elided
Files: files | file ages | folders
SHA1: 5423e10b4c9d26f74c07950d0c064d53aac31615
User & Date: fvogel 2014-12-28 13:57:22
Context
2014-12-28
15:09
Fixed Bad counting of the total number of vertical pixels in the text widget, resulting in small change of the Y scrollbar size. Happened because CalculateDisplayLineHeight expects an index at start of a display line, which was not always the case. check-in: dd92553e user: fvogel tags: text-elided
13:57
Fixed indentation in TkTextUpdateOneLine check-in: 5423e10b user: fvogel tags: text-elided
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTextDisp.c.

3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
	 * Currently this call doesn't have many side-effects. However, if in
	 * the future we change the code so there are side-effects (such as
	 * adjusting linePtr->pixelHeight), then the code might not quite work
	 * as intended, specifically the 'linePtr->pixelHeight == pixelHeight'
	 * test below this while loop.
	 */

	height = CalculateDisplayLineHeight(textPtr, indexPtr, &bytes,
		&logicalLines);

	if (height > 0) {
	    pixelHeight += height;
	    displayLines++;
	}

	mergedLines += logicalLines;

	if (TkTextIndexForwBytes(textPtr, indexPtr, bytes, indexPtr)) {
	    break;
	}

	if (mergedLines == 0) {
	    if (indexPtr->linePtr != linePtr) {
		/*
		 * If we reached the end of the logical line, then either way
		 * we don't have a partial calculation.
		 */

		partialCalc = 0;
		break;
	    }
        } else {
            if (indexPtr->byteIndex != 0) {
	    /*
                * We must still be on the same wrapped line, on a new logical
                * line merged with the logical line 'linePtr'.
	     */
	} else {
	    /*
	     * Must check if indexPtr is really a new logical line which is
	     * not merged with the previous line. The only code that would
	     * really know this is LayoutDLine, which doesn't pass the
	     * information on, so we have to check manually here.
	     */

	    TkTextIndex idx;

	    TkTextIndexBackChars(textPtr, indexPtr, 1, &idx, COUNT_INDICES);
	    if (!TkTextIsElided(textPtr, &idx, NULL)) {
		/*
		 * We've ended a logical line.
		 */

		partialCalc = 0;
		break;
	    }

	    /*
                * We must still be on the same wrapped line, on a new logical
                * line merged with the logical line 'linePtr'.
	     */
	}
        }
	if (partialCalc && displayLines > 50 && mergedLines == 0) {
	    /*
	     * Only calculate 50 display lines at a time, to avoid huge
	     * delays. In any case it is very rare that a single line wraps 50
	     * times!
	     *







|













|
|
|
|
|
|

|
|
|


|
|
|
|
|
|
|
|
|
|
|

|

|
|
|
|
|

|
|
|

|
|
|
|
|







3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
	 * Currently this call doesn't have many side-effects. However, if in
	 * the future we change the code so there are side-effects (such as
	 * adjusting linePtr->pixelHeight), then the code might not quite work
	 * as intended, specifically the 'linePtr->pixelHeight == pixelHeight'
	 * test below this while loop.
	 */

        height = CalculateDisplayLineHeight(textPtr, indexPtr, &bytes,
		&logicalLines);

	if (height > 0) {
	    pixelHeight += height;
	    displayLines++;
	}

	mergedLines += logicalLines;

	if (TkTextIndexForwBytes(textPtr, indexPtr, bytes, indexPtr)) {
	    break;
	}

        if (mergedLines == 0) {
            if (indexPtr->linePtr != linePtr) {
                /*
                 * If we reached the end of the logical line, then either way
                 * we don't have a partial calculation.
                 */

                partialCalc = 0;
                break;
            }
        } else {
            if (indexPtr->byteIndex != 0) {
                /*
                 * We must still be on the same wrapped line, on a new logical
                 * line merged with the logical line 'linePtr'.
                 */
            } else {
                /*
                 * Must check if indexPtr is really a new logical line which is
                 * not merged with the previous line. The only code that would
                 * really know this is LayoutDLine, which doesn't pass the
                 * information on, so we have to check manually here.
                 */

                TkTextIndex idx;

                TkTextIndexBackChars(textPtr, indexPtr, 1, &idx, COUNT_INDICES);
                if (!TkTextIsElided(textPtr, &idx, NULL)) {
                    /*
                     * We've ended a logical line.
                     */

                    partialCalc = 0;
                    break;
                }

                /*
                 * We must still be on the same wrapped line, on a new logical
                 * line merged with the logical line 'linePtr'.
                 */
            }
        }
	if (partialCalc && displayLines > 50 && mergedLines == 0) {
	    /*
	     * Only calculate 50 display lines at a time, to avoid huge
	     * delays. In any case it is very rare that a single line wraps 50
	     * times!
	     *