openbsd-ports/x11/tk/8.0/patches/patch-ac
2000-03-27 02:25:16 +00:00

77 lines
2.8 KiB
Plaintext

--- ../generic/tkText.c.orig Mon Sep 14 14:23:17 1998
+++ ../generic/tkText.c Wed Jan 5 23:20:54 2000
@@ -866,6 +866,7 @@
|| (textPtr->selTagPtr->spacing2String != NULL)
|| (textPtr->selTagPtr->spacing3String != NULL)
|| (textPtr->selTagPtr->tabString != NULL)
+ || (textPtr->selTagPtr->elideString != NULL)
|| (textPtr->selTagPtr->underlineString != NULL)
|| (textPtr->selTagPtr->wrapMode != NULL)) {
textPtr->selTagPtr->affectsDisplay = 1;
@@ -1413,7 +1414,7 @@
}
}
}
- if (segPtr->typePtr == &tkTextCharType) {
+ if (segPtr->typePtr == &tkTextCharType && !TkTextIsElided(textPtr, &textPtr->selIndex)) {
memcpy((VOID *) buffer, (VOID *) (segPtr->body.chars
+ offsetInSeg), (size_t) chunkSize);
buffer += chunkSize;
@@ -1554,7 +1555,7 @@
int argc; /* Number of arguments. */
char **argv; /* Argument strings. */
{
- int backwards, exact, c, i, argsLeft, noCase, leftToScan;
+ int backwards, exact, searchElide, c, i, argsLeft, noCase, leftToScan;
size_t length;
int numLines, startingLine, startingChar, lineNum, firstChar, lastChar;
int code, matchLength, matchChar, passes, stopLine, searchWholeText;
@@ -1565,6 +1566,7 @@
Tcl_DString line, patDString;
TkTextSegment *segPtr;
TkTextLine *linePtr;
+ TkTextIndex curIndex;
Tcl_RegExp regexp = NULL; /* Initialization needed only to
* prevent compiler warning. */
@@ -1573,6 +1575,8 @@
*/
exact = 1;
+ searchElide = 0;
+ curIndex.tree = textPtr->tree;
backwards = 0;
noCase = 0;
varName = NULL;
@@ -1586,7 +1590,7 @@
badSwitch:
Tcl_AppendResult(interp, "bad switch \"", arg,
"\": must be -forward, -backward, -exact, -regexp, ",
- "-nocase, -count, or --", (char *) NULL);
+ "-nocase, -count, -elide, or --", (char *) NULL);
return TCL_ERROR;
}
c = arg[1];
@@ -1601,6 +1605,8 @@
varName = argv[i];
} else if ((c == 'e') && (strncmp(argv[i], "-exact", length) == 0)) {
exact = 1;
+ } else if ((c == 'e') && (strncmp(argv[i], "-elide", length) == 0)) {
+ searchElide = 1;
} else if ((c == 'f') && (strncmp(argv[i], "-forwards", length) == 0)) {
backwards = 0;
} else if ((c == 'n') && (strncmp(argv[i], "-nocase", length) == 0)) {
@@ -1702,9 +1708,10 @@
*/
linePtr = TkBTreeFindLine(textPtr->tree, lineNum);
+ curIndex.linePtr = linePtr; curIndex.charIndex = 0;
for (segPtr = linePtr->segPtr; segPtr != NULL;
- segPtr = segPtr->nextPtr) {
- if (segPtr->typePtr != &tkTextCharType) {
+ curIndex.charIndex += segPtr->size, segPtr = segPtr->nextPtr) {
+ if (segPtr->typePtr != &tkTextCharType || (!searchElide && TkTextIsElided(textPtr, &curIndex))) {
continue;
}
Tcl_DStringAppend(&line, segPtr->body.chars, segPtr->size);