Tk Source Code

Check-in [435148d3]
Login

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

Overview
Comment:Removed an if case that can never happen. In LayoutDLine(), maxBytes is set such that \t (tab) characters, if present, are always the last character of a chunk. Then in TkTextCharLayoutProc() it is useless to test for p[bytesThatFit] == '\t' in the 'bytesThatFit < maxBytes' case.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-1096580fff | soft-hyphen
Files: files | file ages | folders
SHA1: 435148d35c05c7f0e104fa9fbcd4841b4dec9dd3
User & Date: fvogel 2016-10-15 13:40:10
Context
2016-10-16
19:16
Added test textDisp-2.35 testing chunks with both tabs and soft hyphens. check-in: edad03b8 user: fvogel tags: bug-1096580fff, soft-hyphen
2016-10-15
13:40
Removed an if case that can never happen. In LayoutDLine(), maxBytes is set such that \t (tab) characters, if present, are always the last character of a chunk. Then in TkTextCharLayoutProc() it is useless to test for p[bytesThatFit] == '\t' in the 'bytesThatFit < maxBytes' case. check-in: 435148d3 user: fvogel tags: bug-1096580fff, soft-hyphen
2016-10-12
12:05
Removed leftover debug code in new test textDisp-2.33 check-in: c9b5fb9c user: fvogel tags: bug-1096580fff, soft-hyphen
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTextDisp.c.

1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
	}

	gotTab = 0;
	maxBytes = segPtr->size - byteOffset;
	if (segPtr->typePtr == &tkTextCharType) {

	    /*
	     * See if there is a tab in the current chunk; if so, only layout
	     * characters up to (and including) the tab.
	     */

	    if (!elide && justify == TK_JUSTIFY_LEFT) {
		char *p;

		for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {







|







1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
	}

	gotTab = 0;
	maxBytes = segPtr->size - byteOffset;
	if (segPtr->typePtr == &tkTextCharType) {

	    /*
	     * See if there is a tab in the current segment; if so, only layout
	     * characters up to (and including) the tab.
	     */

	    if (!elide && justify == TK_JUSTIFY_LEFT) {
		char *p;

		for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
		    lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
		    &nextX);
#else /* !TK_LAYOUT_WITH_BASE_CHUNKS */
	    bytesThatFit = CharChunkMeasureChars(chunkPtr, p, chLen, 0, -1,
		    chunkPtr->x, -1, 0, &nextX);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
	}
	if ((nextX < maxX) && ((p[bytesThatFit] == ' ')
		|| (p[bytesThatFit] == '\t'))) {
	    /*
	     * Space characters are funny, in that they are considered to fit
	     * if there is at least one pixel of space left on the line. Just
	     * give the space character whatever space is left.
	     */

	    nextX = maxX;







<
|







7592
7593
7594
7595
7596
7597
7598

7599
7600
7601
7602
7603
7604
7605
7606
		    lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
		    &nextX);
#else /* !TK_LAYOUT_WITH_BASE_CHUNKS */
	    bytesThatFit = CharChunkMeasureChars(chunkPtr, p, chLen, 0, -1,
		    chunkPtr->x, -1, 0, &nextX);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
	}

	if ((nextX < maxX) && (p[bytesThatFit] == ' ')) {
	    /*
	     * Space characters are funny, in that they are considered to fit
	     * if there is at least one pixel of space left on the line. Just
	     * give the space character whatever space is left.
	     */

	    nextX = maxX;