listbox hotkeys




I use Directory hotlist a lot. Constantly, really.

It's always bugged me that I can only access the
first 10 items with the keys 0-9. After sitting on
my TODO list for about 2 years, I finally had a
scratch at the issue.

Keys a-z are very often used by the menu of the
dialog the listbox is in, but keys A-Z are not.

So I did this:

[code]
--- lib/widget/listbox.c~       2015-03-20 11:06:04.000000000 -0700
+++ lib/widget/listbox.c        2015-05-24 09:21:52.000000000 -0700
@@ -328,10 +328,15 @@ listbox_key (WListbox * l, int key)
         return MSG_NOT_HANDLED;

     /* focus on listbox item N by '0'..'9' keys */
-    if (key >= '0' && key <= '9')
+    if ((key >= '0' && key <= '9')||(key >= 'A' && key <= 'Z'))
     {
         int oldpos = l->pos;
-        listbox_select_entry (l, key - '0');
+        if (key >= 'A' && key <= 'Z') {
+            listbox_select_entry (l, key - 55);
+        } else {
+            listbox_select_entry (l, key - '0');
+        }
+

         /* need scroll to item? */
         if (abs (oldpos - l->pos) > WIDGET (l)->lines)
[/code]
Diffed from 4.8.14 tarball.

It seems to work fine. Now I can access the top 36
items instead of just the top 10. But, of course, it
affects all listboxes program-wide. It seems OK to me
so far.

My question this:

Does this seem like a useful feature (ie ticket-worthy)
or am I missing some far-reaching consequence I have not
uncovered yet?



--
Peace and Cheer


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]