diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
| commit | 0d5336db012f45753abace489f18f0ca299c6961 (patch) | |
| tree | b1bf3280a9046df99226158978502eeb26f5b0a3 /generic/tkTextBTree.c | |
| parent | e97381a6d921de403516d5b761539a450f4af83c (diff) | |
| parent | 1320b8a2a9c1269a345d44d673a7a35707fbbe9c (diff) | |
| download | tk-core-tip-626.zip tk-core-tip-626.tar.gz tk-core-tip-626.tar.bz2 | |
Merge 9.0core-tip-626
Diffstat (limited to 'generic/tkTextBTree.c')
| -rw-r--r-- | generic/tkTextBTree.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 4810b30..7a65ee1 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -2019,32 +2019,32 @@ TkBTreeLinesTo( } } if (textPtr != NULL) { - /* - * The index to return must be relative to textPtr, not to the entire - * tree. Take care to never return a negative index when linePtr - * denotes a line before -startline, or an index larger than the - * number of lines in textPtr when linePtr is a line past -endline. - */ - - int indexStart, indexEnd; - - if (textPtr->start != NULL) { - indexStart = TkBTreeLinesTo(NULL, textPtr->start); - } else { - indexStart = 0; - } - if (textPtr->end != NULL) { - indexEnd = TkBTreeLinesTo(NULL, textPtr->end); - } else { - indexEnd = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL); - } - if (index < indexStart) { - index = 0; - } else if (index > indexEnd) { - index = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr); - } else { - index -= indexStart; - } + /* + * The index to return must be relative to textPtr, not to the entire + * tree. Take care to never return a negative index when linePtr + * denotes a line before -startline, or an index larger than the + * number of lines in textPtr when linePtr is a line past -endline. + */ + + int indexStart, indexEnd; + + if (textPtr->start != NULL) { + indexStart = TkBTreeLinesTo(NULL, textPtr->start); + } else { + indexStart = 0; + } + if (textPtr->end != NULL) { + indexEnd = TkBTreeLinesTo(NULL, textPtr->end); + } else { + indexEnd = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL); + } + if (index < indexStart) { + index = 0; + } else if (index > indexEnd) { + index = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr); + } else { + index -= indexStart; + } } return index; } |
