Tk Source Code

Check-in [75aaba86]
Login

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

Overview
Comment:bug-3021557 Moving the cursor in elided text freezes Tk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-3021557
Files: files | file ages | folders
SHA1: 75aaba86eeefc5c084b45be8822965c757accf24
User & Date: jan.nijtmans 2012-01-17 05:33:25
Context
2012-01-19
05:43
[Bug-3021557]: Moving the cursor in elided text freezes Tk check-in: 32dd4021 user: jan.nijtmans tags: core-8-5-branch
2012-01-17
05:33
bug-3021557 Moving the cursor in elided text freezes Tk Closed-Leaf check-in: 75aaba86 user: jan.nijtmans tags: bug-3021557
2011-12-22
18:42
3235256 - Keep menu entry IDs out of system values. Thanks Colin McDonald. check-in: 39071084 user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2011-11-22  Jan Nijtmans  <[email protected]>

	* doc/wish.1: Use the same shebang comment everywhere.
	* library/demos/hello
	* library/demos/rmt
	* library/demos/square
	* library/demos/tcolor
>
>
>
>
>







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

	* generic/tkText.c: [Bug-3021557]: Moving the cursor in
	* tests/text.test:  elided text freezes Tk

2011-11-22  Jan Nijtmans  <[email protected]>

	* doc/wish.1: Use the same shebang comment everywhere.
	* library/demos/hello
	* library/demos/rmt
	* library/demos/square
	* library/demos/tcolor

Changes to generic/tkText.c.

903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
		index = *indexFromPtr;
		index.byteIndex = 0;

		/*
		 * We're going to count up all display lines in the logical
		 * line of 'indexFromPtr' up to, but not including the logical
		 * line of 'indexToPtr', and then subtract off what we didn't
		 * what from 'from' and add on what we didn't count from 'to.
		 */

		while (index.linePtr != indexToPtr->linePtr) {
		    value += TkTextUpdateOneLine(textPtr, fromPtr,0,&index,0);

		    /*
		     * We might have skipped past indexToPtr, if we have
		     * multiple logical lines in a single display line.
		     * Therefore we iterate through each intermediate logical
		     * line, just to check. Another approach would be just to
		     * use TkTextIndexCmp on every while() iteration, but that
		     * would be less efficient.
		     */

		    while (fromPtr != index.linePtr) {
			fromPtr = TkBTreeNextLine(textPtr, fromPtr);
			if (fromPtr == indexToPtr->linePtr) {
			    break;
			}
		    }
		}

		/*
		 * Now we need to adjust the count to add on the number of
		 * display lines in the last logical line, and subtract off
		 * the number of display lines overcounted in the first







|








<
<
<
<

|
<
<
<
|
<







903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918




919
920



921

922
923
924
925
926
927
928
		index = *indexFromPtr;
		index.byteIndex = 0;

		/*
		 * We're going to count up all display lines in the logical
		 * line of 'indexFromPtr' up to, but not including the logical
		 * line of 'indexToPtr', and then subtract off what we didn't
		 * want from 'from' and add on what we didn't count from 'to.
		 */

		while (index.linePtr != indexToPtr->linePtr) {
		    value += TkTextUpdateOneLine(textPtr, fromPtr,0,&index,0);

		    /*
		     * We might have skipped past indexToPtr, if we have
		     * multiple logical lines in a single display line.




		     */
		    if (TkTextIndexCmp(&index,indexToPtr) > 0) {



			break;

		    }
		}

		/*
		 * Now we need to adjust the count to add on the number of
		 * display lines in the last logical line, and subtract off
		 * the number of display lines overcounted in the first

Changes to tests/text.test.

679
680
681
682
683
684
685















686
687
688
689
690
691
692
    set res [.t count -displaylines 1.0 end]
    .t configure -wrap $old_wrap
    set res
} {3}
test text-9.2.43 {TextWidgetCmd procedure, "count" option} {
    .t count -lines -chars -indices -displaylines 1.0 end
} {3 903 903 45}















.t configure -wrap none

# Newer tags are higher priority
.t tag configure elide1 -elide 0
.t tag configure elide2 -elide 1
.t tag configure elide3 -elide 0
.t tag configure elide4 -elide 1







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







679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
    set res [.t count -displaylines 1.0 end]
    .t configure -wrap $old_wrap
    set res
} {3}
test text-9.2.43 {TextWidgetCmd procedure, "count" option} {
    .t count -lines -chars -indices -displaylines 1.0 end
} {3 903 903 45}
test text-9.2.44 {TextWidgetCmd procedure, "count" option} -setup {
    .t delete 1.0 end
    update
    set res {}
} -body {
    .t insert end "Line 1 - This is Line 1\n"
    .t insert end "Line 2 - This is Line 2\n"
    .t insert end "Line 3 - This is Line 3\n"
    .t insert end "Line 4 - This is Line 4\n"
    .t insert end "Line 5 - This is Line 5\n"
    lappend res [.t count -displaylines 1.19 3.24] [.t count -displaylines 1.0 end]
    .t tag add hidden 2.9 3.17
    .t tag configure hidden -elide true
    lappend res [.t count -displaylines 1.19 3.24] [.t count -displaylines 1.0 end]
} -result {2 6 2 5}
.t configure -wrap none

# Newer tags are higher priority
.t tag configure elide1 -elide 0
.t tag configure elide2 -elide 1
.t tag configure elide3 -elide 0
.t tag configure elide4 -elide 1