Re: mc Digest, Vol 116, Issue 1



WoW! Thanks.
The only thing that's missing for me, is how to do
gmail, without http, and handle all the TLS..?..stuff.
OTOH it can be disasterous to keep adding trivial features.
But of course for me handling gmail is not trivial,
like <moving the hot-dir list> which you only do
once every 2 weeks. Or ?


On 12/2/13, mc-request gnome org <mc-request gnome org> wrote:
Send mc mailing list submissions to
      mc gnome org

To subscribe or unsubscribe via the World Wide Web, visit
      https://mail.gnome.org/mailman/listinfo/mc
or, via email, send a message with subject or body 'help' to
      mc-request gnome org

You can reach the person managing the list at
      mc-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of mc digest..."


Today's Topics:

   1. Directory hotlist (Miven)
   2. Midnight Commander 4.8.11 released (Slava Zanko)


----------------------------------------------------------------------

Message: 1
Date: Sun, 01 Dec 2013 16:08:04 -0800
From: Miven <mdooligan gmail com>
To: "mc gnome org" <mc gnome org>
Subject: Directory hotlist
Message-ID: <op w7fum9g4uu71lx timberwolf electromag net>
Content-Type: text/plain; charset=iso-8859-1

Directory hotlist (C-\) has no way to add the current directory
to the beginning of the list, short of appending it and then moving it
to the top. A bit of a pain.

So I thought I'd have a go at the appropriate code modifications in
hotlist.c and hotlist.h. I added the option "Insert current &before"
so that now the 'a' key appends and the 'b' key inserts the current
directory before the selected one. At the top by default if you don't
move the cursor position.

No problem. It works exactly as I want, except for 1 odd thing:

l_hotlist->pos for some strange reason keeps getting decremented
so that the current cursor pos in the hotlist ends up being the item
*before* the inserted item.

I traced this to lib/widget/listbox.c. In listbox_append_item()
we have these lines:

    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--;
        break;

Why do we decrement l->pos here? This doesn't seem right, and it's the
culprit in this anomaly. If anything it should be incremented so as
to keep the cursor on the same list item it was on before the insert.

With l->pos decrementing like this repeated calls to listbox_append_item()
from the middle of a list make the new items appear every 2nd item
alternating, working towards the beginning of the list, skipping one
each time. The only places LISTBOX_APPEND_BEFORE appears is in
dialog-switch.c:void dialog_switch_list (void) and hotlist.c.

Anyway, I commented those 2 lines out of listbox_append_item()
and now my mod works as it should, the cursor being left on the
newly inserted item, not the one before it.

Any ideas?



[code]

--- src/filemanager/hotlist.h~  2013-12-01 08:33:45.000000000 -0800
+++ src/filemanager/hotlist.h   2013-12-01 08:48:46.000000000 -0800
@@ -22,6 +22,7 @@ typedef enum

 /*** declarations of public functions
************************************************************/

+void insert2hotlist_cmd (void);
 void add2hotlist_cmd (void);
 char *hotlist_show (hotlist_t list_type);
 gboolean save_hotlist (void);
--- src/filemanager/hotlist.c~  2013-08-02 08:02:39.000000000 -0700
+++ src/filemanager/hotlist.c   2013-12-01 15:34:51.353531859 -0800
@@ -89,6 +89,7 @@
 #define B_FREE_ALL_VFS  (B_USER + 9)
 #define B_REFRESH_VFS   (B_USER + 10)
 #endif
+#define B_INSERT_BEFORE (B_USER + 11)

 #define TKN_GROUP   0
 #define TKN_ENTRY   1
@@ -185,9 +186,11 @@ static struct
     { B_REFRESH_VFS, NORMAL_BUTTON, 0, 43, 0, N_("&Refresh"),
             LIST_VFSLIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM },
 #endif
-    { B_ADD_CURRENT, NORMAL_BUTTON, 0, 20, 0, N_("&Add current"),
+    { B_INSERT_BEFORE, NORMAL_BUTTON, 0, 20, 0, N_("Insert current
&before"),
             LIST_HOTLIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM },
-    { B_UP_GROUP, NORMAL_BUTTON, 0, 42, 0, N_("&Up"),
+    { B_ADD_CURRENT, NORMAL_BUTTON, 0, 35, 0, N_("&Append current"),
+            LIST_HOTLIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM },
+    { B_UP_GROUP, NORMAL_BUTTON, 0, 57, 0, N_("&Up"),
             LIST_HOTLIST | LIST_MOVELIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM
},
     { B_CANCEL, NORMAL_BUTTON, 0, 53, 0, N_("&Cancel"),
             LIST_HOTLIST | LIST_VFSLIST | LIST_MOVELIST, WPOS_KEEP_RIGHT |
WPOS_KEEP_BOTTOM },
@@ -424,6 +427,10 @@ hotlist_button_callback (WButton * butto
         add_new_group_cmd ();
         return 0;

+    case B_INSERT_BEFORE:
+        insert2hotlist_cmd ();
+        return 0;
+
     case B_ADD_CURRENT:
         add2hotlist_cmd ();
         return 0;
@@ -1561,6 +1568,39 @@ add_dotdot_to_list (void)
 /*
---------------------------------------------------------------------------------------------
*/

 void
+insert2hotlist_cmd (void)
+{
+    char *lc_prompt;
+    const char *cp = N_("Label for \"%s\":");
+    int l;
+    char *label_string, *label;
+
+#ifdef ENABLE_NLS
+    cp = _(cp);
+#endif
+
+    l = str_term_width1 (cp);
+    label_string = vfs_path_to_str_flags (current_panel->cwd_vpath, 0,
VPF_STRIP_PASSWORD);
+    lc_prompt = g_strdup_printf (cp, str_trunc (label_string, COLS - 2 * UX
- (l + 8)));
+    label =
+        input_dialog (_("Insert to hotlist"), lc_prompt,
MC_HISTORY_HOTLIST_ADD, label_string,
+                      INPUT_COMPLETE_NONE);
+    g_free (lc_prompt);
+
+    if (label == NULL || *label == '\0')
+    {
+        g_free (label_string);
+        g_free (label);
+    }
+    else
+    {
+        add2hotlist (label, label_string, HL_TYPE_ENTRY,
LISTBOX_APPEND_BEFORE);
+        hotlist_state.modified = TRUE;
+    }
+}
+
+
+void
 add2hotlist_cmd (void)
 {
     char *lc_prompt;
--- lib/widget/listbox.c~       2013-12-01 15:26:56.053538768 -0800
+++ lib/widget/listbox.c        2013-12-01 11:20:28.000000000 -0800
@@ -336,8 +336,8 @@ 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--;
+//        if (l->pos > 0)
+//            l->pos--;
         break;

     case LISTBOX_APPEND_AFTER:

[/code]

--
Peace and Cheer


------------------------------

Message: 2
Date: Mon, 02 Dec 2013 11:45:11 +0300
From: Slava Zanko <slavazanko gmail com>
To: mc-users-list <mc gnome org>, MC Devel <mc-devel gnome org>
Subject: Midnight Commander 4.8.11 released
Message-ID: <529C4897 7080902 gmail com>
Content-Type: text/plain; charset="iso-8859-1"


Hi all,

mc-4.8.11 now released.

Download page: http://www.midnight-commander.org/downloads?order=id&desc=1


Major changes and fixes since 4.8.10
(https://www.midnight-commander.org/wiki/NEWS-4.8.11):

- Core
  * Live update of panels size when editing layout (#3060)
  * Support "Compute totals" option in move file operation (#2075)

- VFS
  * rpm extfs
    - show dependency version (#2812)
    - support tar payload (#3064)
    - improve support for EPOCH tag (#1588)
    - add support for PREINPROG/POSTINPROG/PREUNPROG/POSTUNPROG,
VERIFYSCRIPTPROG and TRIGGERSCRIPTS/TRIGGERSCRIPTPROG
tags (#1588)

- Editor
  * Support "bracketed paste mode" of xterm (#2661)
  * Clarify Java syntax highlighting (#3057)

- Misc
  * Print warnings about unknown '--with-' / '--enable-' configure options
(#3029)
  * Code cleanup and refactoring (#3051, #3066)

- Fixes
  * FTBFS on GNU Hurd (#3053, #3071)
  * Segfault while moving files (#3059, #3105)
  * Broken handling of mc command line arguments (#3047)
  * Copy/move doesn't work if num_history_items_recorded=0 (#3076)
  * No subdir path completion in current dir, if stub is not starting with
'./' (#3018)
  * Deprecated "find -perm +xxx" syntax is used (#3089)
  * Home, End, Shift-Fn keys don't work in tmux (#2978)
  * Improper [en|dis]abling of layout dialog split adjustment buttons
(#3061)
  * Bogus strings in 'Confirmation' config dialog (#2271)
  * "Configure options" first entry not highlighted (#3084)
  * "Setup saved to ~/.config/mc/ini" message is misleading (#3096)
  * F3 doesn't work on .so files in FreeBSD 9.x (#3101)
  * Typo in mc.lib: "less=%filename +%linenog" instead of "+%lineno" (part
of #3044)
  * Wrong order of filename and line number for external editor (part of
#3044)
  * mcedit: tabs are lost when text is pasted (#1797 as part of #2661)
  * mcedit: question on large file treats Escape as Yes (#3107)
  * Broken case-sensitive search in editor/viewer/diffviewer (#3069)
  * Changes to files in nested .zip archives are lost (#3070)
  * Incorrect handling of filenames with spaces with unrar v5 (#3073)
  * iso9660 VFS: filenames truncating in ISO file listing (#3091)
  * vfs_path_from_str_flags() doesn't support VPF_STRIP_HOME (#3098)
  * Bright colors are used as background colors in 16-color skins (#3050)
  * Various defects in documentation (#3052, #3092)




--
WBR, dev team.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL:
<https://mail.gnome.org/archives/mc/attachments/20131202/fe78232b/attachment.sig>

------------------------------

Subject: Digest Footer

_______________________________________________
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


------------------------------

End of mc Digest, Vol 116, Issue 1
**********************************



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