Tk Source Code

Check-in [8709902f]
Login

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

Overview
Comment:Fix typo and add comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | revised_text | tip-466
Files: files | file ages | folders
SHA3-256: 8709902f3cf7b90ceea41ebc6ced888b1b959ee08d00f3ee46410b61bc4a2f38
User & Date: fvogel 2025-02-01 13:06:34
Context
2025-02-01
14:38
Fix logic error in comment. We are in the case (actualElided != shouldBeElided), i.e. these two boolean variables are different. Inside this case, we're in the else clause of an 'if (shouldBeElided)', therefore this else clause is the case 'if (actualElided)', not 'if (!actualElided)'. check-in: e4ceb24e user: fvogel tags: revised_text, tip-466
13:06
Fix typo and add comments. check-in: 8709902f user: fvogel tags: revised_text, tip-466
2025-01-28
20:54
Merge 9.0. [5f739d2253] will be handled in separate commit check-in: d6343387 user: jan.nijtmans tags: revised_text, tip-466
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tkTextBTree.c.
1200
1201
1202
1203
1204
1205
1206





1207
1208
1209
1210
1211
1212
1213
1214





1215
1216
1217
1218
1219
1220
1221
static TkTextSegment * MakeLink()   { return MakeSegment(SEG_SIZE(TkTextLink),   0, &tkTextLinkType);   }
static TkTextSegment * MakeHyphen() { return MakeSegment(SEG_SIZE(TkTextHyphen), 1, &tkTextHyphenType); }

static int
IsBranchSection(
    const TkTextSection *sectionPtr)
{





    assert(sectionPtr);
    return sectionPtr->nextPtr && sectionPtr->nextPtr->segPtr->prevPtr->typePtr == &tkTextBranchType;
}

static int
IsLinkSection(
    const TkTextSection *sectionPtr)
{





    assert(sectionPtr);
    return sectionPtr->segPtr->typePtr == &tkTextLinkType;
}

/*
 * Some functions for the undo/redo mechanism.
 */







>
>
>
>
>








>
>
>
>
>







1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
static TkTextSegment * MakeLink()   { return MakeSegment(SEG_SIZE(TkTextLink),   0, &tkTextLinkType);   }
static TkTextSegment * MakeHyphen() { return MakeSegment(SEG_SIZE(TkTextHyphen), 1, &tkTextHyphenType); }

static int
IsBranchSection(
    const TkTextSection *sectionPtr)
{
    /*
     * A section is a branch section if and only if it ends with a branch segment.
     * Branch segments are always the last segment of a section.
     */

    assert(sectionPtr);
    return sectionPtr->nextPtr && sectionPtr->nextPtr->segPtr->prevPtr->typePtr == &tkTextBranchType;
}

static int
IsLinkSection(
    const TkTextSection *sectionPtr)
{
    /*
     * A section is a link section if and only if it starts with a link segment.
     * Link segments are always the first segment of a section.
     */

    assert(sectionPtr);
    return sectionPtr->segPtr->typePtr == &tkTextLinkType;
}

/*
 * Some functions for the undo/redo mechanism.
 */
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189

    /*
     * We have to ensure that a branch will not be followed by marks,
     * and a link will not be preceded by marks.
     */

    assert(!prevPtr || prevPtr->nextPtr);	/* mark cannot be last segment */
    assert(linePtr->segPtr);			/* dito */

    if (TkBTreeHaveElidedSegments(sharedTextPtr)) {
	if (prevPtr) {
	    if (prevPtr->typePtr == &tkTextBranchType) {
		prevPtr = prevPtr->prevPtr;
	    } else if (prevPtr->nextPtr->typePtr == &tkTextLinkType) {
		prevPtr = prevPtr->nextPtr;







|







5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199

    /*
     * We have to ensure that a branch will not be followed by marks,
     * and a link will not be preceded by marks.
     */

    assert(!prevPtr || prevPtr->nextPtr);	/* mark cannot be last segment */
    assert(linePtr->segPtr);			/* ditto */

    if (TkBTreeHaveElidedSegments(sharedTextPtr)) {
	if (prevPtr) {
	    if (prevPtr->typePtr == &tkTextBranchType) {
		prevPtr = prevPtr->prevPtr;
	    } else if (prevPtr->nextPtr->typePtr == &tkTextLinkType) {
		prevPtr = prevPtr->nextPtr;