Tk Source Code

Check-in [a69ad2fd]
Login

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

Overview
Comment:Bugfix [a34b49f8c6]: Missing cases with justifying right and center added.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | revised_text | tip-466
Files: files | file ages | folders
SHA1: a69ad2fd43bae85b0b734003ad6af970a947b140
User & Date: gcramer 2017-07-04 09:44:00
Original Comment: Bugfix a34b49f8c6: Missing cases with justifying right and center added.
References
2017-07-04
19:24 Ticket [a34b49f8] text widget: tag -tabs does not work properly. (textDisp-2.26) status still Open with 3 other changes artifact: 75b4b92b user: fvogel
Context
2017-07-07
15:22
Hardending: a few assertions added. check-in: 2f81be65 user: gcramer tags: revised_text, tip-466
2017-07-04
09:44
Bugfix [a34b49f8c6]: Missing cases with justifying right and center added. check-in: a69ad2fd user: gcramer tags: revised_text, tip-466
2017-07-02
15:45
Add numerous [text] test cases to guard against possible regressions regarding bugs recently fixed, especially crashes and failed assertions. check-in: d69c43af user: fvogel tags: revised_text, tip-466
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTextDisp.c.

3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
	}

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

	if (data->justify == TK_TEXT_JUSTIFY_LEFT) {
	    const char *p = base;
	    unsigned i;

	    /* TODO: also TK_TEXT_JUSTIFY_RIGHT should support tabs */
	    /* TODO: direction of tabs should depend on gravity of insert mark?! */

	    for (i = 0; i < maxBytes; ++i, ++p) {
		if (*p == '\t') {
		    maxBytes = i + 1;
		    gotTab = true;
		    break;
		}
	    }
	} else if (data->justify == TK_TEXT_JUSTIFY_FULL) {
	    const char *p = base;
	    const char *e = p + maxBytes;

	    for ( ; p < e && !IsExpandableSpace(p); ++p) {
		if (*p == '\t') {
		    chunkPtr->numSpaces = 0;
		    maxBytes = p - base + 1;







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<







3309
3310
3311
3312
3313
3314
3315
3316














3317
3318
3319
3320
3321
3322
3323
	}

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

	if (data->justify == TK_TEXT_JUSTIFY_FULL) {














	    const char *p = base;
	    const char *e = p + maxBytes;

	    for ( ; p < e && !IsExpandableSpace(p); ++p) {
		if (*p == '\t') {
		    chunkPtr->numSpaces = 0;
		    maxBytes = p - base + 1;
3356
3357
3358
3359
3360
3361
3362













3363
3364
3365
3366
3367
3368
3369
			break;
		    }

		    p = Tcl_UtfNext(p);
		} while (IsExpandableSpace(p));

		maxBytes = p - base;













	    }
	}
    }

    if (maxBytes == 0) {
	/*
	 * In seldom cases, if hyphenation is activated, we may have an empty







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







3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
			break;
		    }

		    p = Tcl_UtfNext(p);
		} while (IsExpandableSpace(p));

		maxBytes = p - base;
	    }
	} else {
	    const char *p = base;
	    unsigned i;

	    /* TODO: direction of tabs should depend on gravity of insert mark?! */

	    for (i = 0; i < maxBytes; ++i, ++p) {
		if (*p == '\t') {
		    maxBytes = i + 1;
		    gotTab = true;
		    break;
		}
	    }
	}
    }

    if (maxBytes == 0) {
	/*
	 * In seldom cases, if hyphenation is activated, we may have an empty