Update to tk 8.5.19
This commit is contained in:
@@ -197,18 +197,18 @@ static const Tk_OptionSpec optionSpecs[] = {
|
||||
TK_OPTION_NULL_OK, (ClientData) DEF_TEXT_SELECT_BD_MONO, 0},
|
||||
{TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background",
|
||||
DEF_TEXT_SELECT_FG_COLOR, -1, Tk_Offset(TkText, selFgColorPtr),
|
||||
TK_CONFIG_NULL_OK, (ClientData) DEF_TEXT_SELECT_FG_MONO, 0},
|
||||
TK_OPTION_NULL_OK, (ClientData) DEF_TEXT_SELECT_FG_MONO, 0},
|
||||
{TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid",
|
||||
DEF_TEXT_SET_GRID, -1, Tk_Offset(TkText, setGrid), 0, 0, 0},
|
||||
{TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing",
|
||||
DEF_TEXT_SPACING1, -1, Tk_Offset(TkText, spacing1),
|
||||
TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
0, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
{TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing",
|
||||
DEF_TEXT_SPACING2, -1, Tk_Offset(TkText, spacing2),
|
||||
TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
0, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
{TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing",
|
||||
DEF_TEXT_SPACING3, -1, Tk_Offset(TkText, spacing3),
|
||||
TK_OPTION_DONT_SET_DEFAULT, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
0, 0 , TK_TEXT_LINE_GEOMETRY },
|
||||
{TK_OPTION_CUSTOM, "-startline", NULL, NULL,
|
||||
NULL, -1, Tk_Offset(TkText, start), TK_OPTION_NULL_OK,
|
||||
(ClientData) &lineOption, TK_TEXT_LINE_RANGE},
|
||||
@@ -566,14 +566,6 @@ CreateWidget(
|
||||
textPtr->end = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register with the B-tree. In some sense it would be best if we could do
|
||||
* this later (after configuration options), so that any changes to
|
||||
* start,end do not require a total recalculation.
|
||||
*/
|
||||
|
||||
TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight);
|
||||
|
||||
textPtr->state = TK_TEXT_STATE_NORMAL;
|
||||
textPtr->relief = TK_RELIEF_FLAT;
|
||||
textPtr->cursor = None;
|
||||
@@ -583,6 +575,14 @@ CreateWidget(
|
||||
textPtr->prevWidth = Tk_Width(newWin);
|
||||
textPtr->prevHeight = Tk_Height(newWin);
|
||||
|
||||
/*
|
||||
* Register with the B-tree. In some sense it would be best if we could do
|
||||
* this later (after configuration options), so that any changes to
|
||||
* start,end do not require a total recalculation.
|
||||
*/
|
||||
|
||||
TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight);
|
||||
|
||||
/*
|
||||
* This will add refCounts to textPtr.
|
||||
*/
|
||||
@@ -871,7 +871,7 @@ TextWidgetObjCmd(
|
||||
} else if (c == 'd' && (length > 8)
|
||||
&& !strncmp("-displaylines", option, (unsigned) length)) {
|
||||
TkTextLine *fromPtr, *lastPtr;
|
||||
TkTextIndex index;
|
||||
TkTextIndex index, index2;
|
||||
|
||||
int compare = TkTextIndexCmp(indexFromPtr, indexToPtr);
|
||||
value = 0;
|
||||
@@ -906,35 +906,44 @@ TextWidgetObjCmd(
|
||||
/*
|
||||
* 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.
|
||||
* line of 'indexToPtr' (except if this line is elided), and
|
||||
* then subtract off what came in too much from elided lines,
|
||||
* also 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;
|
||||
}
|
||||
while (TkTextIndexCmp(&index,indexToPtr) < 0) {
|
||||
value += TkTextUpdateOneLine(textPtr, index.linePtr,
|
||||
0, &index, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
* logical line. This logic is still ok if both indices are in
|
||||
* the same logical line.
|
||||
*/
|
||||
index2 = index;
|
||||
|
||||
/*
|
||||
* Now we need to adjust the count to:
|
||||
* - subtract off the number of display lines between
|
||||
* indexToPtr and index2, since we might have skipped past
|
||||
* indexToPtr, if we have several logical lines in a
|
||||
* single display line
|
||||
* - subtract off the number of display lines overcounted
|
||||
* in the first logical line
|
||||
* - add on the number of display lines in the last logical
|
||||
* line
|
||||
* This logic is still ok if both indexFromPtr and indexToPtr
|
||||
* are in the same logical line.
|
||||
*/
|
||||
|
||||
index = *indexToPtr;
|
||||
index.byteIndex = 0;
|
||||
while (TkTextIndexCmp(&index,&index2) < 0) {
|
||||
value -= TkTextUpdateOneLine(textPtr, index.linePtr,
|
||||
0, &index, 0);
|
||||
}
|
||||
index.linePtr = indexFromPtr->linePtr;
|
||||
index.byteIndex = 0;
|
||||
while (1) {
|
||||
TkTextFindDisplayLineEnd(textPtr, &index, 1, NULL);
|
||||
if (index.byteIndex >= indexFromPtr->byteIndex) {
|
||||
if (TkTextIndexCmp(&index,indexFromPtr) >= 0) {
|
||||
break;
|
||||
}
|
||||
TkTextIndexForwBytes(textPtr, &index, 1, &index);
|
||||
@@ -946,7 +955,7 @@ TextWidgetObjCmd(
|
||||
index.byteIndex = 0;
|
||||
while (1) {
|
||||
TkTextFindDisplayLineEnd(textPtr, &index, 1, NULL);
|
||||
if (index.byteIndex >= indexToPtr->byteIndex) {
|
||||
if (TkTextIndexCmp(&index,indexToPtr) >= 0) {
|
||||
break;
|
||||
}
|
||||
TkTextIndexForwBytes(textPtr, &index, 1, &index);
|
||||
@@ -2310,6 +2319,7 @@ TextWorldChanged(
|
||||
{
|
||||
Tk_FontMetrics fm;
|
||||
int border;
|
||||
int oldCharHeight = textPtr->charHeight;
|
||||
|
||||
textPtr->charWidth = Tk_TextWidth(textPtr->tkfont, "0", 1);
|
||||
if (textPtr->charWidth <= 0) {
|
||||
@@ -2321,6 +2331,9 @@ TextWorldChanged(
|
||||
if (textPtr->charHeight <= 0) {
|
||||
textPtr->charHeight = 1;
|
||||
}
|
||||
if (textPtr->charHeight != oldCharHeight) {
|
||||
TkBTreeClientRangeChanged(textPtr, textPtr->charHeight);
|
||||
}
|
||||
border = textPtr->borderWidth + textPtr->highlightWidth;
|
||||
Tk_GeometryRequest(textPtr->tkwin,
|
||||
textPtr->width * textPtr->charWidth + 2*textPtr->padX + 2*border,
|
||||
@@ -2990,11 +3003,9 @@ DeleteIndexRange(
|
||||
* The code below is ugly, but it's needed to make sure there is always a
|
||||
* dummy empty line at the end of the text. If the final newline of the
|
||||
* file (just before the dummy line) is being deleted, then back up index
|
||||
* to just before the newline. If there is a newline just before the first
|
||||
* character being deleted, then back up the first index too, so that an
|
||||
* even number of lines gets deleted. Furthermore, remove any tags that
|
||||
* are present on the newline that isn't going to be deleted after all
|
||||
* (this simulates deleting the newline and then adding a "clean" one back
|
||||
* to just before the newline. Furthermore, remove any tags that are
|
||||
* present on the newline that isn't going to be deleted after all (this
|
||||
* simulates deleting the newline and then adding a "clean" one back
|
||||
* again). Note that index1 and index2 might now be equal again which
|
||||
* means that no text will be deleted but tags might be removed.
|
||||
*/
|
||||
@@ -3009,10 +3020,6 @@ DeleteIndexRange(
|
||||
oldIndex2 = index2;
|
||||
TkTextIndexBackChars(NULL, &oldIndex2, 1, &index2, COUNT_INDICES);
|
||||
line2--;
|
||||
if ((index1.byteIndex == 0) && (line1 != 0)) {
|
||||
TkTextIndexBackChars(NULL, &index1, 1, &index1, COUNT_INDICES);
|
||||
line1--;
|
||||
}
|
||||
arrayPtr = TkBTreeGetTags(&index2, NULL, &arraySize);
|
||||
if (arrayPtr != NULL) {
|
||||
for (i = 0; i < arraySize; i++) {
|
||||
@@ -4193,7 +4200,11 @@ TextSearchFoundMatch(
|
||||
matchOffset += Tcl_NumUtfChars(segPtr->body.chars, -1);
|
||||
}
|
||||
} else {
|
||||
leftToScan -= segPtr->size;
|
||||
if (searchSpecPtr->exact) {
|
||||
leftToScan -= segPtr->size;
|
||||
} else {
|
||||
leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1);
|
||||
}
|
||||
}
|
||||
curIndex.byteIndex += segPtr->size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user