Bug#32542: dselect search should also look at package descriptions
I'm hoping that this will get added to the bug report for Bug#32542 and
distributed to the appropriate parties: I'm not entirely familiar with the
bug tracking system, so apologies in advance if I am mistaken.
Here follows a patch for this bug against dpkg version 1.6.1
(Taken from potato/main/source/dpkg_1.6.1.tar.gz)
This patch simply makes the standard search search the package descriptions
as well as the package titles: it may be desirable to allow the user to
separate these facilities, but I find the functionality provided by this
patch to be much more useful than the current functionality.
--
Richard Boulton <richard@tartarus.org>
diff -ru dpkg-1.6.1.orig/dselect/baselist.cc dpkg-1.6.1/dselect/baselist.cc
--- dpkg-1.6.1.orig/dselect/baselist.cc Thu Oct 28 15:05:47 1999
+++ dpkg-1.6.1/dselect/baselist.cc Thu Dec 2 01:20:05 1999
@@ -267,16 +267,30 @@
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 (thisname) {
+ 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;
+ }
+ }
+ thisname= iteminfo(index);
+ if (thisname) {
+ 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;
+ }
+ }
+
}
beep();
}
diff -ru dpkg-1.6.1.orig/dselect/dselect.h dpkg-1.6.1/dselect/dselect.h
--- dpkg-1.6.1.orig/dselect/dselect.h Wed Oct 13 16:52:49 1999
+++ dpkg-1.6.1/dselect/dselect.h Thu Dec 2 01:15:13 1999
@@ -101,6 +101,7 @@
virtual void redrawtitle() =0;
virtual void setwidths() =0;
virtual const char *itemname(int index) =0;
+ virtual const char *iteminfo(int index) =0;
virtual const struct helpmenuentry *helpmenulist() =0;
void wordwrapinfo(int offset, const char *string);
diff -ru dpkg-1.6.1.orig/dselect/methlist.cc dpkg-1.6.1/dselect/methlist.cc
--- dpkg-1.6.1.orig/dselect/methlist.cc Thu Oct 28 15:05:48 1999
+++ dpkg-1.6.1/dselect/methlist.cc Thu Dec 2 01:19:52 1999
@@ -41,6 +41,10 @@
return table[index]->name;
}
+const char *methodlist::iteminfo(int index) {
+ return NULL;
+}
+
void methodlist::kd_abort() { }
void methodlist::kd_quit() {
diff -ru dpkg-1.6.1.orig/dselect/method.h dpkg-1.6.1/dselect/method.h
--- dpkg-1.6.1.orig/dselect/method.h Fri Jan 29 08:54:00 1999
+++ dpkg-1.6.1/dselect/method.h Thu Dec 2 01:14:51 1999
@@ -56,6 +56,7 @@
void redrawtitle();
void setwidths();
const char *itemname(int index);
+ const char *iteminfo(int index);
const struct helpmenuentry *helpmenulist();
public:
diff -ru dpkg-1.6.1.orig/dselect/pkgcmds.cc dpkg-1.6.1/dselect/pkgcmds.cc
--- dpkg-1.6.1.orig/dselect/pkgcmds.cc Sat Oct 30 14:09:59 1999
+++ dpkg-1.6.1/dselect/pkgcmds.cc Thu Dec 2 01:19:34 1999
@@ -151,6 +151,14 @@
return table[index]->pkg->name;
}
+const char *packagelist::iteminfo(int index) {
+ if(table[index]->pkg->name == NULL) return NULL;
+ pkginfoperfile *r = &(table[index]->pkg->available);
+ if(!(r->valid)) r = &(table[index]->pkg->installed);
+ if(!(r->valid)) return NULL;
+ return r->description;
+}
+
void packagelist::kd_swapstatorder() {
if (sortorder == so_unsorted) return;
switch (statsortorder) {
diff -ru dpkg-1.6.1.orig/dselect/pkglist.h dpkg-1.6.1/dselect/pkglist.h
--- dpkg-1.6.1.orig/dselect/pkglist.h Fri Jan 29 08:54:00 1999
+++ dpkg-1.6.1/dselect/pkglist.h Thu Dec 2 01:14:56 1999
@@ -136,6 +136,7 @@
void redrawtitle();
void setwidths();
const char *itemname(int index);
+ const char *iteminfo(int index);
const struct helpmenuentry *helpmenulist();
// Miscellaneous internal routines
Reply to: