test_search() was supposed to compare bookmark titles with
strcasestr(), but in commit 311d95358de258656a0c7145a2dcff943fcdcd4b
"bug 153, 1066: Convert bookmarks to/from UTF-8 when searching."
on 2009-02-08, I inadvertently changed that to strcasecmp(), even
while adding a comment about why strcasestr() is needed.  strcasestr()
returns non-NULL if the strings match, and strcasecmp() returns
nonzero if they differ, so the search didn't work at all.
---
Stephen Stocker <l...@terraworld.net> writes:

>    Since sometime before Feb 14, 2009, the bookmark search feature seems to 
> be 
> broken in the daily snapshots. If I hit "s" to display the bookmarks dialog, 
> then "s" again to search, and type in whatever I'm looking for, it moves to 
> the 
> next item in the bookmarks. Searching again moves it ahead one item again, 
> and 
> so on. In other words, everything appears to match the search.

Thanks for reporting this.  It was my fault.
I have pushed the following fix to elinks-0.12 now.
It can be cleanly merged to master.  I didn't push the merge.

 src/bookmarks/dialogs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c
index 69340b1..b20815c 100644
--- a/src/bookmarks/dialogs.c
+++ b/src/bookmarks/dialogs.c
@@ -687,8 +687,8 @@ test_search(struct listbox_item *item, void *data_, int 
*offset)
                        }
 
                        if (title) {
-                               ctx->found = strcasecmp(title,
-                                                       ctx->title);
+                               ctx->found = (strcasestr(title, ctx->title)
+                                             != NULL);
                                mem_free(title);
                        }
                        /** @todo Tell the user that the string could
-- 
1.6.0.6.4.g22c5
_______________________________________________
elinks-users mailing list
elinks-users@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to