Re: listbox hotkeys

2015-05-28 Thread Mooffie
On 5/24/15, Mike Smithson mdooli...@gmail.com wrote:

 It's always bugged me that I can only access the
 first 10 items with the keys 0-9.
 [...]
 Keys a-z are very often used by the menu of the
 dialog the listbox is in, but keys A-Z are not.
 [...]
 Now I can access the top 36 items instead of just
 the top 10.

But isn't it hard to count, say, 27 items mentally? Isn't it easier
to just press the arrows repeatedly? I think that's a question the
maintainers are going to ask you.

(Otherwise I don't see a problem with your code. But you'd want to
change the - 55 to - 'A' + 10 and remove the curly brackets
(that's their laws).)

Anyway, you can do all such tweakings in mc^2 without touching the C
code. Here, I translated your code to Lua:

https://github.com/mooffie/mc/blob/lua-4.8.14-port/src/lua/tests/snippets/listbox_AZ.lua

I've also created a new module today that lets you associate hotkeys
with the directories there. Again, no C coding is required. Here's a
screenshot (note the yellow arrows):

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/SCREENSHOTS.md.html#Find_as_you_type__hotkeys__clock

(Isn't this feature what you *really* want?)


 I use Directory hotlist a lot. Constantly, really.

A few weeks ago somebody said he's using the File edit/view history
of Dos Navigator several hundred times a day[1]. After implementing
it (better) in mc^2 I can say the same. I mention it because many
times (thanks to its Quick filter entry[2]) one can use it as a
replacement for the Directory hotlist dialog.

[1] http://www.midnight-commander.org/ticket/280#comment:25
[2] 
http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/SCREENSHOTS.md.html#Recently_Visited_Files__xterm_titles
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


listbox hotkeys

2015-05-24 Thread Mike Smithson


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.0 -0700
+++ lib/widget/listbox.c2015-05-24 09:21:52.0 -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
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel