]> err.no Git - dpkg/commitdiff
use new checkserach and matchsearch functions to do the real search/matching
authorWichert Akkerman <wakkerma@debian.org>
Mon, 16 Jul 2001 15:23:49 +0000 (15:23 +0000)
committerWichert Akkerman <wakkerma@debian.org>
Mon, 16 Jul 2001 15:23:49 +0000 (15:23 +0000)
dselect/baselist.cc

index 5a29e275077558159b80e043114aab88dae52298..c74a45c3cf12f6c41e6dd9e89170e2df7dc3f1a8 100644 (file)
@@ -3,6 +3,7 @@
  * baselist.cc - list of somethings
  *
  * Copyright (C) 1994,1995 Ian Jackson <iwj10@cus.cam.ac.uk>
+ * Copyright (C) 2001 Wichert Akkerman <wakkerma@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -274,27 +275,20 @@ void baselist::itd_keys() {
 }
 
 void baselist::dosearch() {
-  int offset, index, searchlen;
-  searchlen= strlen(searchstring);
-  if (debug) fprintf(debug,"packagelist[%p]::dosearch(); searchstring=`%s' len=%d\n",
-                     this,searchstring,searchlen);
+  int offset, index;
+  if (debug) fprintf(debug,"baselist[%p]::dosearch(); searchstring=`%s'\n",
+                     this,searchstring);
   for (offset=1, index=greaterint(topofscreen,cursorline+1);
        offset<nitems;
        offset++, index++) {
     if (index >= nitems) index -= nitems;
-    int lendiff, i;
-    const char *thisname;
-    thisname= itemname(index);
-    if (!thisname) continue;
-    lendiff= strlen(thisname) - searchlen;
-    for (i=0; i<=lendiff; i++)
-      if (!strncasecmp(thisname + i, searchstring, searchlen)) {
-        topofscreen= index-1;
-        if (topofscreen > nitems - list_height) topofscreen= nitems-list_height;
-        if (topofscreen < 0) topofscreen= 0;
-        setcursor(index);
-        return;
-      }
+    if (matchsearch(index)) {
+      topofscreen= index-1;
+      if (topofscreen > nitems - list_height) topofscreen= nitems-list_height;
+      if (topofscreen < 0) topofscreen= 0;
+      setcursor(index);
+      return;
+    }
   }
   beep();
 }
@@ -374,3 +368,6 @@ void baselist::wordwrapinfo(int offset, const char *m) {
 }
 
 baselist::~baselist() { }
+
+/* vi: sw=2 ts=8
+ */