diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-25 19:16:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-25 19:16:36 (GMT) |
commit | f2ecf42d53b17282da36e109e89fe2acd1b55c2c (patch) | |
tree | 0826a66e1f63db518901f5f3a25d9d20457b364c /generic/tkText.c | |
parent | d5d5545c57a09377d515cc3a613f42d8c9f07baf (diff) | |
parent | e7f49c28281e68c1fc9330c7a132f90d3742652a (diff) | |
download | tk-f2ecf42d53b17282da36e109e89fe2acd1b55c2c.zip tk-f2ecf42d53b17282da36e109e89fe2acd1b55c2c.tar.gz tk-f2ecf42d53b17282da36e109e89fe2acd1b55c2c.tar.bz2 |
Merge trunk
Diffstat (limited to 'generic/tkText.c')
-rw-r--r-- | generic/tkText.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index 80b5a12..bea19d8 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -661,7 +661,7 @@ CreateWidget( Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING, TextFetchSelection, textPtr, XA_STRING); - if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin) + if (Tk_InitOptions(interp, textPtr, optionTable, textPtr->tkwin) != TCL_OK) { Tk_DestroyWindow(textPtr->tkwin); return TCL_ERROR; @@ -764,7 +764,7 @@ TextWidgetObjCmd( result = TCL_ERROR; goto done; } else { - Tcl_Obj *objPtr = Tk_GetOptionValue(interp, (char *) textPtr, + Tcl_Obj *objPtr = Tk_GetOptionValue(interp, textPtr, textPtr->optionTable, objv[2], textPtr->tkwin); if (objPtr == NULL) { @@ -827,7 +827,7 @@ TextWidgetObjCmd( } case TEXT_CONFIGURE: if (objc <= 3) { - Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) textPtr, + Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, textPtr, textPtr->optionTable, ((objc == 3) ? objv[2] : NULL), textPtr->tkwin); @@ -5076,7 +5076,7 @@ DumpSegment( Tcl_DecrRefCount(tuple); return 0; } else { - int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); + TkSizeT oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); Tcl_DString buf; int code; @@ -5903,7 +5903,7 @@ SearchCore( firstOffset = 0; } - if (alreadySearchOffset != -1) { + if (alreadySearchOffset >= 0) { if (searchSpecPtr->backwards) { if (alreadySearchOffset < lastOffset) { lastOffset = alreadySearchOffset; @@ -5992,17 +5992,17 @@ SearchCore( * match. */ - const char c = pattern[0]; + const char c = matchLength ? pattern[0] : '\0'; - if (alreadySearchOffset != -1) { + if (alreadySearchOffset >= 0) { p = startOfLine + alreadySearchOffset; alreadySearchOffset = -1; } else { p = startOfLine + lastOffset -1; } while (p >= startOfLine + firstOffset) { - if (p[0] == c && !strncmp(p, pattern, - (size_t) matchLength)) { + if (matchLength == 0 || (p[0] == c && !strncmp( + p, pattern, (size_t) matchLength))) { goto backwardsMatch; } p--; @@ -6165,10 +6165,14 @@ SearchCore( if (firstNewLine != -1) { break; } else { - alreadySearchOffset -= matchLength; + alreadySearchOffset -= (matchLength ? matchLength : 1); + if (alreadySearchOffset < 0) { + break; + } } } else { - firstOffset = p - startOfLine + matchLength; + firstOffset = matchLength ? p - startOfLine + matchLength + : p - startOfLine + 1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find @@ -6829,7 +6833,7 @@ SetLineStartEnd( TkText *textPtr = (TkText *) recordPtr; if (internalOffset >= 0) { - internalPtr = recordPtr + internalOffset; + internalPtr = (char *)recordPtr + internalOffset; } else { internalPtr = NULL; } |