Incorrect behavior in Hotlist -> Insert

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

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

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--;
+         */


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

Any comments? Is this ticket worthy?

Peace and Cheer

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