Incorrect behavior in Hotlist - Insert

2013-12-31 Thread Mike Smithson

I use directory hotlist a lot. Often I have project that
I work heavily on for a few days or a week, then it's
finished. I like my new hotlist entries to appear at (or near)
the top of the list so I can just go C-\ ENTER and I'm there.
Then when project is done, I remove the entry, or move it
down the list. I think this is a super-useful feature of mc
and one of the things that makes it so effective. But...

In the panel, if I do:

C-\ (for hotlist)
...scroll down a few entries...
e (new entry)
M-I (Insert)

the new entry gets inserted before the cursor, but the
cursor jumps to the entry *before* the new one; that is,
the cursor jumps up two places. This seems disorienting
and incorrect to me.

I've traced it to

[code]
--- lib/widget/listbox.c~   2013-11-29 10:27:07.0 -0800
+++ lib/widget/listbox.c2013-12-02 09:11:26.191188317 -0800
@@ -336,8 +336,9 @@ listbox_append_item (WListbox * l, WLEnt

 case LISTBOX_APPEND_BEFORE:
 l-list = g_list_insert_before (l-list, g_list_nth (l-list,  
l-pos), e);

-if (l-pos  0)
-l-pos--;
+/*
+ * Why do we decrement here?
+ * if (l-pos  0)
+ *   l-pos--;
+ */
 break;

 case LISTBOX_APPEND_AFTER:
[/code]

Not decrementing (as I have done here by commenting out the lines)
leaves the cursor on the new entry. This seems *more* correct than
jumping up two entries. Incrementing l-pos would leave the cursor
on the entry it was on before the insertion.

I know this is trivial issue, because LISTBOX_APPEND_BEFORE is
rarely used in the code, but still, I believe the decrement is
incorrect, and the only reason nobody notices this bug is because
the cursor position is often set deliberately right after the
insert.

Any comments? Is this ticket worthy?

--
Peace and Cheer
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: Incorrect behavior in Hotlist - Insert

2013-12-31 Thread Andrew Borodin
On Tue, 31 Dec 2013 19:14:09 -0800 Mike Smithson wrote:
 Not decrementing (as I have done here by commenting out the lines)
 leaves the cursor on the new entry. This seems *more* correct than
 jumping up two entries.

I agree. I removed the decrement of l-pos in the 2290_find_file_speedup branch
(temporary commit is da8810e6b40f667595ca54b28c62eb5452058f28).

-- 
Andrew
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc