summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericm <ericm>2000-01-21 17:25:43 (GMT)
committerericm <ericm>2000-01-21 17:25:43 (GMT)
commit809ff15f94c450ae08db7edb4c6c0d405760664e (patch)
tree55079ad404083b03faafabf25989029cf5e94c9b
parent6efdc96d666911bae091301b1fccb28bc5865437 (diff)
downloadtk-809ff15f94c450ae08db7edb4c6c0d405760664e.zip
tk-809ff15f94c450ae08db7edb4c6c0d405760664e.tar.gz
tk-809ff15f94c450ae08db7edb4c6c0d405760664e.tar.bz2
* tests/text.test:
* generic/tkText.c: Fixed bug relating to regexp searching for empty lines; previously, the starting line was ignored. (bug #1643).
-rw-r--r--generic/tkText.c5
-rw-r--r--tests/text.test9
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