witten
/
luminotes
Archived
1
0
Fork 0

Fixed bug in which bolding of suggest-as-you-type search text was case sensitive. Now it's case insensitive.

This commit is contained in:
Dan Helfman 2008-06-29 22:49:29 -07:00
parent 333e90459d
commit 48f58d0c0e
3 changed files with 8 additions and 2 deletions

4
NEWS
View File

@ -1,3 +1,7 @@
1.4.11: June 29, 2008:
* Fixed bug in which bolding of suggest-as-you-type search text was case
sensitive. Now it's case insensitive.
1.4.10: June 29, 2008:
* New suggest-as-you-type feature for creating a new link, setting a link's
destination, and even for searching a notebook.

View File

@ -944,7 +944,9 @@ class Notebooks( object ):
notes = self.__database.select_many( Note, Notebook.sql_search_titles( notebook_id, search_text ) )
for note in notes:
note.summary = note.summary.replace( search_text, u"<b>%s</b>" % search_text )
# do a case-insensitive replace to wrap the search term with bold
search_text_pattern = re.compile( u"(%s)" % re.escape( search_text ), re.I )
note.summary = search_text_pattern.sub( r"<b>\1</b>", note.summary )
return dict(
notes = notes,

View File

@ -2921,7 +2921,7 @@ class Test_notebooks( Test_controller ):
assert len( notes ) == 1
assert notes[ 0 ].object_id == self.note2.object_id
assert notes[ 0 ].title == self.note2.title
assert notes[ 0 ].summary == self.note2.title.replace( search_text, u"<b>%s</b>" % search_text )
assert notes[ 0 ].summary == u"<b>other</b> title"
def test_search_titles_empty( self ):
self.login()