From 809ff15f94c450ae08db7edb4c6c0d405760664e Mon Sep 17 00:00:00 2001 From: ericm Date: Fri, 21 Jan 2000 17:25:43 +0000 Subject: * tests/text.test: * generic/tkText.c: Fixed bug relating to regexp searching for empty lines; previously, the starting line was ignored. (bug #1643). --- generic/tkText.c | 5 +++-- tests/text.test | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/generic/tkText.c b/generic/tkText.c index cc3db83..fb51ed4 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.12 2000/01/21 03:54:42 hobbs Exp $ + * RCS: @(#) $Id: tkText.c,v 1.13 2000/01/21 17:25:43 ericm Exp $ */ #include "default.h" @@ -1884,7 +1884,8 @@ TextSearchCmd(textPtr, interp, argc, argv) */ firstByte = indexInDString; - if (firstByte >= Tcl_DStringLength(&line)) { + if ((firstByte >= Tcl_DStringLength(&line)) + && !((Tcl_DStringLength(&line) == 0) && !exact)) { goto nextLine; } } else { diff --git a/tests/text.test b/tests/text.test index 3ae14bb..d7b4210 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.8 2000/01/21 03:55:06 hobbs Exp $ +# RCS: @(#) $Id: text.test,v 1.9 2000/01/21 17:25:43 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -961,6 +961,13 @@ test text-20.34 {TextSearchCmd procedure, firstChar and lastChar} { test text-20.35 {TextSearchCmd procedure, firstChar and lastChar} { .t search {} end } {1.0} +test text-20.36 {TextSearchCmd procedure, regexp finds empty lines} { + # Test for fix of bug #1643 + .t insert end "\n" + tkTextSetCursor .t 4.0 + .t search -forward -regexp {^$} insert end +} {4.0} + catch {destroy .t2} toplevel .t2 wm geometry .t2 +0+0 -- cgit v0.12