]> granicus.if.org Git - python/commitdiff
Merged revisions 69461 via svnmerge from
authorGuilherme Polo <ggpolo@gmail.com>
Mon, 9 Feb 2009 16:44:24 +0000 (16:44 +0000)
committerGuilherme Polo <ggpolo@gmail.com>
Mon, 9 Feb 2009 16:44:24 +0000 (16:44 +0000)
svn+ssh://pythondev/python/trunk

........
  r69461 | guilherme.polo | 2009-02-09 14:41:09 -0200 (Mon, 09 Feb 2009) | 3 lines

  Fixed issue #4890: Handle empty text search pattern in
  Tkinter.Text.search
........

Lib/tkinter/__init__.py
Misc/NEWS

index a6397ea701829b764be54074772d21c5af892a0d..af49170568a31bb727a2571db56dc43efbb067d5 100644 (file)
@@ -3016,7 +3016,8 @@ class Text(Widget):
            forwards=None, backwards=None, exact=None,
            regexp=None, nocase=None, count=None, elide=None):
         """Search PATTERN beginning from INDEX until STOPINDEX.
-        Return the index of the first character of a match or an empty string."""
+        Return the index of the first character of a match or an
+        empty string."""
         args = [self._w, 'search']
         if forwards: args.append('-forwards')
         if backwards: args.append('-backwards')
@@ -3025,7 +3026,7 @@ class Text(Widget):
         if nocase: args.append('-nocase')
         if elide: args.append('-elide')
         if count: args.append('-count'); args.append(count)
-        if pattern[0] == '-': args.append('--')
+        if pattern and pattern[0] == '-': args.append('--')
         args.append(pattern)
         args.append(index)
         if stopindex: args.append(stopindex)
index 5a3b4adad1bc1ff9e3ecbf0f60635bbcb772aad9..7cfddb2c195854842fd4fe2712570cc3d4e11644 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -160,6 +160,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #4890: Handle empty text search pattern in Tkinter.Text.search.
+
 - Issue #4512 (part 2): Promote ``ZipImporter._get_filename()`` to be a
   public documented method ``ZipImporter.get_filename()``.