From 50af33b1a13e1b6c55e100130ec1e8c22e4beab6 Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Mon, 15 Nov 2004 13:09:07 +0000 Subject: fix to one multi-line search bug --- ChangeLog | 5 +++++ generic/tkText.c | 11 ++++++++++- tests/text.test | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd1bf28..f15adb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-11-15 Vince Darley + + * generic/tkText.c: fix to multi-line search problem and + * tests/text.test: removed 'knownBug' from one test. + 2004-11-15 Donal K. Fellows * unix/tcl.m4, unix/configure.in: Expanded all AC_DEFINE calls to diff --git a/generic/tkText.c b/generic/tkText.c index eb7beb7..9f1f6ac 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.54 2004/09/23 14:57:03 vincentdarley Exp $ + * RCS: @(#) $Id: tkText.c,v 1.55 2004/11/15 13:09:07 vincentdarley Exp $ */ #include "default.h" @@ -5530,6 +5530,15 @@ SearchCore(interp, searchSpecPtr, patObj) || info.extendStart < 0) { break; } + /* + * If there is a match, but that match starts + * after the end of the first line, then we'll + * handle that next time around, when we're + * actually looking at that line. + */ + if (match && (info.matches[0].start >= lastOffset)) { + break; + } if (match && ((firstOffset + info.matches[0].end) >= prevFullLine)) { linesSearched = extraLines; diff --git a/tests/text.test b/tests/text.test index 70cbaa2..76f28a6 100644 --- a/tests/text.test +++ b/tests/text.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: text.test,v 1.34 2004/11/09 12:46:10 vincentdarley Exp $ +# RCS: @(#) $Id: text.test,v 1.35 2004/11/15 13:09:08 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -2648,7 +2648,7 @@ test text-20.172 {TextSearchCmd, regexp search multi-line} {knownBug} { # Should match at 1.0 for a true greedy match } {1.0} -test text-20.172.1 {TextSearchCmd, regexp search multi-line} {knownBug} { +test text-20.172.1 {TextSearchCmd, regexp search multi-line} { deleteWindows pack [text .t2] .t2 insert 1.0 "line0\nline1\nline1\nline1\nline1\nline2\nline2\nline2\nline3\n" -- cgit v0.12