Ticket #2697: quickfilter.patch

File quickfilter.patch, 85.5 KB (added by chris_c, 4 years ago)

Implementation of quickfilter feature

  • src/filemanager/boxes.c

    From 16ff3b68c40b4d95c4fe43a60ff6acf49563af11 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 18:34:13 +0200
    Subject: [PATCH 01/30] Add option and capability of filtering directories.
    
    ---
     src/filemanager/boxes.c | 2 +-
     src/filemanager/dir.c   | 7 ++++++-
     src/setup.c             | 3 +++
     src/setup.h             | 1 +
     4 files changed, 11 insertions(+), 2 deletions(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 05d365a..43e30d3 100644
    a b configure_box (void) 
    519519                    QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL), 
    520520                    QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), 
    521521                    QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), 
    522                     QUICK_SEPARATOR (FALSE), 
     522                    QUICK_CHECKBOX (N_("Filter directories"), &filter_dirs, NULL), 
    523523                    QUICK_SEPARATOR (FALSE), 
    524524                    QUICK_SEPARATOR (FALSE), 
    525525                QUICK_STOP_GROUPBOX, 
  • src/filemanager/dir.c

    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index 1b1557a..ad539d4 100644
    a b handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    150150               int *stale_link) 
    151151{ 
    152152    vfs_path_t *vpath; 
     153    gboolean add_directory; 
    153154 
    154155    if (DIR_IS_DOT (dp->d_name) || DIR_IS_DOTDOT (dp->d_name)) 
    155156        return FALSE; 
    handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    187188 
    188189    vfs_path_free (vpath); 
    189190 
    190     return (S_ISDIR (buf1->st_mode) || *link_to_dir != 0 || fltr == NULL 
     191    add_directory = false; 
     192    if(!filter_dirs) 
     193        add_directory = S_ISDIR (buf1->st_mode); 
     194 
     195    return (add_directory || *link_to_dir != 0 || fltr == NULL 
    191196            || mc_search (fltr, NULL, dp->d_name, MC_SEARCH_T_GLOB)); 
    192197} 
    193198 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 951edb8..cad52b0 100644
    a b int use_file_to_check_type = 1; 
    169169 
    170170int verbose = 1; 
    171171 
     172int filter_dirs = 0; 
     173 
    172174/* 
    173175 * Whether the Midnight Commander tries to provide more 
    174176 * information about copy/move sizes and bytes transferred 
    static const struct 
    367369    { "mcview_remember_file_position", &mcview_remember_file_position }, 
    368370    { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, 
    369371    { "copymove_persistent_attr", &setup_copymove_persistent_attr }, 
     372    { "filter_dirs", &filter_dirs }, 
    370373    { NULL, NULL } 
    371374}; 
    372375 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index 58a8865..975b854 100644
    a b struct mc_fhl_struct; 
    7676/* global paremeters */ 
    7777extern char *global_profile_name; 
    7878extern int confirm_delete; 
     79extern int filter_dirs; 
    7980extern int confirm_directory_hotlist_delete; 
    8081extern int confirm_execute; 
    8182extern int confirm_exit; 
  • src/filemanager/boxes.c

    -- 
    2.9.0
    
    
    From 3d6494b130c026ced06d9442690eb0743a18eced Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 20:39:51 +0200
    Subject: [PATCH 02/30] Add simple quickfilter capabilites.
    
    ---
     src/filemanager/boxes.c |  3 +-
     src/filemanager/panel.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++--
     src/filemanager/panel.h |  3 ++
     src/setup.c             |  4 ++-
     src/setup.h             |  1 +
     5 files changed, 96 insertions(+), 5 deletions(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 43e30d3..ccb7758 100644
    a b panel_options_box (void) 
    628628                    QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL), 
    629629                    QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup, 
    630630                                    NULL), 
    631                     QUICK_SEPARATOR (FALSE), 
     631                    QUICK_CHECKBOX (N_("Use Quickfilter"), &panels_options.use_quickfilter, 
     632                                    NULL), 
    632633                    QUICK_SEPARATOR (FALSE), 
    633634                    QUICK_SEPARATOR (FALSE), 
    634635                QUICK_STOP_GROUPBOX, 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 19f8327..9b3d6ad 100644
    a b adjust_top_file (WPanel * panel) 
    13861386 
    13871387/* --------------------------------------------------------------------------------------------- */ 
    13881388/** add "#enc:encodning" to end of path */ 
    1389 /* if path end width a previous #enc:, only encoding is changed no additional  
     1389/* if path end width a previous #enc:, only encoding is changed no additional 
    13901390 * #enc: is appended 
    13911391 * retun new string 
    13921392 */ 
    stop_search (WPanel * panel) 
    27802780} 
    27812781 
    27822782/* --------------------------------------------------------------------------------------------- */ 
     2783 
     2784static void 
     2785apply_quickpanel_filter (WPanel * p) 
     2786{ 
     2787    //TODO: add case insensitive capabilities! 
     2788    size_t l, fl; 
     2789    g_free (p->filter); 
     2790    p->filter = 0; 
     2791 
     2792    l = strlen(p->quickfilter_buffer); 
     2793    fl = l + 2 + 1; // + 2 for *<filter>*, 1 for ending \0 
     2794    p->filter = g_malloc(fl); 
     2795    if(p->filter) 
     2796    { 
     2797        p->filter[0] = '*'; 
     2798        memcpy(p->filter + 1, p->quickfilter_buffer, l); 
     2799        p->filter[fl - 2] = '*'; 
     2800        p->filter[fl - 1] = '\0'; 
     2801    } 
     2802 
     2803    //Always reread cmd! 
     2804    reread_cmd (); 
     2805} 
     2806 
     2807static void 
     2808stop_quickfilter(WPanel * panel) 
     2809{ 
     2810    panel->quickfiltering = FALSE; 
     2811    panel->quickfilter_buffer[0] = '\0'; 
     2812    g_free(panel->filter); 
     2813    panel->filter = 0; 
     2814    reread_cmd (); 
     2815} 
     2816 
     2817static void 
     2818do_quickfilter(WPanel * panel, int key) 
     2819{ 
     2820    size_t l; 
     2821    l = strlen(panel->quickfilter_buffer); 
     2822    if(key == KEY_BACKSPACE) 
     2823    { 
     2824        if (l <= 1) 
     2825        { 
     2826            stop_quickfilter(panel); 
     2827            return; 
     2828        } 
     2829        panel->quickfilter_buffer[l - 1] = '\0'; 
     2830    } 
     2831    else 
     2832    { 
     2833        //TODO: Check if key results in empty panel 
     2834        panel->quickfilter_buffer[l] = (char) key; 
     2835        panel->quickfilter_buffer[l + 1] = '\0'; 
     2836    } 
     2837    apply_quickpanel_filter(panel); 
     2838} 
     2839 
     2840static void 
     2841start_quickfilter(WPanel * panel) 
     2842{ 
     2843    //Check if somebody used the normal filter already. 
     2844    if (panel->quickfiltering || !panel->filter) 
     2845        panel->quickfiltering = TRUE; 
     2846    return; 
     2847} 
     2848 
     2849/* --------------------------------------------------------------------------------------------- */ 
    27832850/** Return TRUE if the Enter key has been processed, FALSE otherwise */ 
    27842851 
    27852852static gboolean 
    panel_key (WPanel * panel, int key) 
    36153682        return MSG_HANDLED; 
    36163683    } 
    36173684 
     3685    if(panel->quickfiltering && ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE)) 
     3686    { 
     3687        do_quickfilter(panel, key); 
     3688        return MSG_HANDLED; 
     3689    } 
     3690 
    36183691    for (i = 0; panel_map[i].key != 0; i++) 
    36193692        if (key == panel_map[i].key) 
    36203693            return panel_execute_cmd (panel, panel_map[i].command); 
    panel_key (WPanel * panel, int key) 
    36273700 
    36283701    if (!command_prompt && ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE)) 
    36293702    { 
    3630         start_search (panel); 
    3631         do_search (panel, key); 
     3703        if(!panels_options.use_quickfilter) 
     3704        { 
     3705            start_search (panel); 
     3706            do_search (panel, key); 
     3707        } 
     3708        else 
     3709        { 
     3710            start_quickfilter(panel); 
     3711            do_quickfilter(panel, key); 
     3712        } 
    36323713        return MSG_HANDLED; 
    36333714    } 
    36343715 
    panel_new_with_dir (const char *panel_name, const vfs_path_t * vpath) 
    43224403    panel->total = 0; 
    43234404    panel->dirty = 1; 
    43244405    panel->searching = FALSE; 
     4406    panel->quickfiltering = FALSE; 
    43254407    panel->dirs_marked = 0; 
    43264408    panel->is_panelized = FALSE; 
    43274409    panel->format = NULL; 
    panel_new_with_dir (const char *panel_name, const vfs_path_t * vpath) 
    43404422    for (i = 0; i < LIST_TYPES; i++) 
    43414423        panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT); 
    43424424 
     4425    panel->quickfilter_buffer[0] = '\0'; 
     4426 
    43434427    panel->search_buffer[0] = '\0'; 
    43444428    panel->prev_search_buffer[0] = '\0'; 
    43454429    panel->frame_size = frame_half; 
  • src/filemanager/panel.h

    diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h
    index d3f792e..0aa75f8 100644
    a b typedef struct 
    133133    int codepage;               /* panel codepage */ 
    134134#endif 
    135135 
     136    gboolean quickfiltering; 
     137    char quickfilter_buffer[MC_MAXFILENAMELEN]; 
     138 
    136139    gboolean searching; 
    137140    char search_buffer[MC_MAXFILENAMELEN]; 
    138141    char prev_search_buffer[MC_MAXFILENAMELEN]; 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index cad52b0..2dc7622 100644
    a b panels_options_t panels_options = { 
    145145    .permission_mode = FALSE, 
    146146    .qsearch_mode = QSEARCH_PANEL_CASE, 
    147147    .torben_fj_mode = FALSE, 
    148     .select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS 
     148    .select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS, 
     149    .use_quickfilter = FALSE 
    149150}; 
    150151 
    151152int easy_patterns = 1; 
    static const struct 
    410411    { "filetype_mode", &panels_options.filetype_mode }, 
    411412    { "permission_mode", &panels_options.permission_mode }, 
    412413    { "torben_fj_mode", &panels_options.torben_fj_mode }, 
     414    { "use_quickfilter", &panels_options.use_quickfilter }, 
    413415    { NULL, NULL } 
    414416}; 
    415417/* *INDENT-ON* */ 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index 975b854..1576d4e 100644
    a b typedef struct 
    5555    qsearch_mode_t qsearch_mode;        /* Quick search mode */ 
    5656    gboolean torben_fj_mode;    /* If TRUE, use some usability hacks by Torben */ 
    5757    panel_select_flags_t select_flags;  /* Select/unselect file flags */ 
     58    gboolean use_quickfilter; 
    5859} panels_options_t; 
    5960 
    6061typedef struct macro_action_t 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From fcb6860d581744f360c30a5524fb195c7f0677e1 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 20:41:57 +0200
    Subject: [PATCH 03/30] Automatically stop filter once a different command has
     been entered.
    
    ---
     src/filemanager/panel.c | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 9b3d6ad..c05fcb6 100644
    a b panel_execute_cmd (WPanel * panel, long command) 
    34903490    if (command != CK_Search) 
    34913491        stop_search (panel); 
    34923492 
     3493    if(panel->quickfiltering) 
     3494        stop_quickfilter(panel); 
     3495 
    34933496    switch (command) 
    34943497    { 
    34953498    case CK_Up: 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 9b389eafb623b06a1e4f227977e0667f0ab1b4c2 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 20:52:11 +0200
    Subject: [PATCH 04/30] Be somehwat more differentiating at choosing when to
     stop quickfiltering and when not
    
    ---
     src/filemanager/panel.c | 19 ++++++++++++++++---
     1 file changed, 16 insertions(+), 3 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index c05fcb6..a951463 100644
    a b directory_history_list (WPanel * panel) 
    34853485static cb_ret_t 
    34863486panel_execute_cmd (WPanel * panel, long command) 
    34873487{ 
     3488    gboolean bstop_quickfilter = FALSE; 
    34883489    int res = MSG_HANDLED; 
    34893490 
    34903491    if (command != CK_Search) 
    34913492        stop_search (panel); 
    34923493 
    3493     if(panel->quickfiltering) 
    3494         stop_quickfilter(panel); 
    3495  
    34963494    switch (command) 
    34973495    { 
    34983496    case CK_Up: 
    panel_execute_cmd (WPanel * panel, long command) 
    35143512    { 
    35153513    case CK_PanelOtherCd: 
    35163514        chdir_other_panel (panel); 
     3515        bstop_quickfilter = TRUE; 
    35173516        break; 
    35183517    case CK_PanelOtherCdLink: 
    35193518        chdir_to_readlink (panel); 
     3519        bstop_quickfilter = TRUE; 
    35203520        break; 
    35213521    case CK_CopySingle: 
    35223522        copy_cmd_local (); 
    panel_execute_cmd (WPanel * panel, long command) 
    35263526        break; 
    35273527    case CK_Enter: 
    35283528        do_enter (panel); 
     3529        bstop_quickfilter = TRUE; 
    35293530        break; 
    35303531    case CK_ViewRaw: 
    35313532        view_raw_cmd (); 
    panel_execute_cmd (WPanel * panel, long command) 
    35563557        break; 
    35573558    case CK_CdChild: 
    35583559        goto_child_dir (panel); 
     3560        bstop_quickfilter = TRUE; 
    35593561        break; 
    35603562    case CK_CdParent: 
    35613563        goto_parent_dir (panel); 
     3564        bstop_quickfilter = TRUE; 
    35623565        break; 
    35633566    case CK_History: 
    35643567        directory_history_list (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    35953598        break; 
    35963599    case CK_CdParentSmart: 
    35973600        res = force_maybe_cd (); 
     3601        bstop_quickfilter = TRUE; 
    35983602        break; 
    35993603    case CK_Up: 
    36003604        move_up (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    36043608        break; 
    36053609    case CK_Left: 
    36063610        res = move_left (panel); 
     3611        bstop_quickfilter = TRUE; 
    36073612        break; 
    36083613    case CK_Right: 
    36093614        res = move_right (panel); 
     3615        bstop_quickfilter = TRUE; 
    36103616        break; 
    36113617    case CK_Bottom: 
    36123618        move_end (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    36173623#ifdef HAVE_CHARSET 
    36183624    case CK_SelectCodepage: 
    36193625        panel_change_encoding (panel); 
     3626        bstop_quickfilter = TRUE; 
    36203627        break; 
    36213628#endif 
    36223629    case CK_ScrollLeft: 
    panel_execute_cmd (WPanel * panel, long command) 
    36273634        break; 
    36283635    case CK_Search: 
    36293636        start_search (panel); 
     3637        bstop_quickfilter = TRUE; 
    36303638        break; 
    36313639    case CK_SearchStop: 
    36323640        break; 
    panel_execute_cmd (WPanel * panel, long command) 
    36633671        break; 
    36643672    } 
    36653673 
     3674    if(bstop_quickfilter) 
     3675    { 
     3676        stop_quickfilter(panel); 
     3677    } 
     3678 
    36663679    return res; 
    36673680} 
    36683681 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From f73ffa164aff0a679daefb84e548380ac2ba93e1 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 20:56:56 +0200
    Subject: [PATCH 05/30] Do pointer checks against NULL, only stop
     quickfiltering if we actually were quickfiltering
    
    ---
     src/filemanager/panel.c | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index a951463..d2d4326 100644
    a b apply_quickpanel_filter (WPanel * p) 
    27922792    l = strlen(p->quickfilter_buffer); 
    27932793    fl = l + 2 + 1; // + 2 for *<filter>*, 1 for ending \0 
    27942794    p->filter = g_malloc(fl); 
    2795     if(p->filter) 
     2795    if(p->filter != NULL) 
    27962796    { 
    27972797        p->filter[0] = '*'; 
    27982798        memcpy(p->filter + 1, p->quickfilter_buffer, l); 
    apply_quickpanel_filter (WPanel * p) 
    28072807static void 
    28082808stop_quickfilter(WPanel * panel) 
    28092809{ 
     2810    if (!panel->stop_quickfilter) 
     2811    { 
     2812        return; 
     2813    } 
    28102814    panel->quickfiltering = FALSE; 
    28112815    panel->quickfilter_buffer[0] = '\0'; 
    28122816    g_free(panel->filter); 
    static void 
    28412845start_quickfilter(WPanel * panel) 
    28422846{ 
    28432847    //Check if somebody used the normal filter already. 
    2844     if (panel->quickfiltering || !panel->filter) 
     2848    if (panel->quickfiltering || panel->filter == NULL) 
    28452849        panel->quickfiltering = TRUE; 
    28462850    return; 
    28472851} 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 49466fe008847441f9530739e04f45f037014434 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 21:01:20 +0200
    Subject: [PATCH 06/30] Fix compile error due to incorrectly used identifier
    
    ---
     src/filemanager/panel.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index d2d4326..aa2f218 100644
    a b apply_quickpanel_filter (WPanel * p) 
    28072807static void 
    28082808stop_quickfilter(WPanel * panel) 
    28092809{ 
    2810     if (!panel->stop_quickfilter) 
     2810    if (!panel->quickfiltering) 
    28112811    { 
    28122812        return; 
    28132813    } 
  • src/filemanager/boxes.c

    -- 
    2.9.0
    
    
    From 02f057dc0c6ae2e35ea7c3a485b8a08c82021d99 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Tue, 5 Jul 2016 21:27:19 +0200
    Subject: [PATCH 07/30] Start work on allowing case insensitive quickfiltering
    
    ---
     src/filemanager/boxes.c | 13 +++++++++++++
     src/filemanager/panel.c |  5 +----
     src/setup.c             | 14 +++++++++++++-
     src/setup.h             |  8 ++++++++
     4 files changed, 35 insertions(+), 5 deletions(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index ccb7758..7358ce4 100644
    a b panel_options_box (void) 
    612612            N_("Use panel sort mo&de") 
    613613        }; 
    614614 
     615        const char *qfilter_options[] = { 
     616            N_("Case insensitive"), 
     617            N_("Case sensitive") 
     618        }; 
     619 
    615620        quick_widget_t quick_widgets[] = { 
    616621            /* *INDENT-OFF* */ 
    617622            QUICK_START_COLUMNS, 
    panel_options_box (void) 
    632637                                    NULL), 
    633638                    QUICK_SEPARATOR (FALSE), 
    634639                    QUICK_SEPARATOR (FALSE), 
     640                    QUICK_SEPARATOR (FALSE), 
     641                    QUICK_SEPARATOR (FALSE), 
     642                    QUICK_SEPARATOR (FALSE), 
     643                    QUICK_SEPARATOR (FALSE), 
    635644                QUICK_STOP_GROUPBOX, 
    636645            QUICK_NEXT_COLUMN, 
    637646                QUICK_START_GROUPBOX (N_("Navigation")), 
    panel_options_box (void) 
    650659                    QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode, 
    651660                                 NULL), 
    652661                QUICK_STOP_GROUPBOX, 
     662                QUICK_START_GROUPBOX (N_("Quick filter")), 
     663                    QUICK_RADIO (QFILTER_NUM, qfilter_options, (int *) &panels_options.qfilter_mode, 
     664                                 NULL), 
     665                QUICK_STOP_GROUPBOX, 
    653666            QUICK_STOP_COLUMNS, 
    654667            QUICK_BUTTONS_OK_CANCEL, 
    655668            QUICK_END 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index aa2f218..d63513e 100644
    a b stop_search (WPanel * panel) 
    27842784static void 
    27852785apply_quickpanel_filter (WPanel * p) 
    27862786{ 
    2787     //TODO: add case insensitive capabilities! 
    27882787    size_t l, fl; 
    27892788    g_free (p->filter); 
    27902789    p->filter = 0; 
    27912790 
    27922791    l = strlen(p->quickfilter_buffer); 
    2793     fl = l + 2 + 1; // + 2 for *<filter>*, 1 for ending \0 
     2792    fl = l + 2 + 1; // + 2 for *<filter>*, 1 for trailing \0 
    27942793    p->filter = g_malloc(fl); 
    27952794    if(p->filter != NULL) 
    27962795    { 
    apply_quickpanel_filter (WPanel * p) 
    28002799        p->filter[fl - 1] = '\0'; 
    28012800    } 
    28022801 
    2803     //Always reread cmd! 
    28042802    reread_cmd (); 
    28052803} 
    28062804 
    do_quickfilter(WPanel * panel, int key) 
    28442842static void 
    28452843start_quickfilter(WPanel * panel) 
    28462844{ 
    2847     //Check if somebody used the normal filter already. 
    28482845    if (panel->quickfiltering || panel->filter == NULL) 
    28492846        panel->quickfiltering = TRUE; 
    28502847    return; 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 2dc7622..7d1fe16 100644
    a b panels_options_t panels_options = { 
    146146    .qsearch_mode = QSEARCH_PANEL_CASE, 
    147147    .torben_fj_mode = FALSE, 
    148148    .select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS, 
    149     .use_quickfilter = FALSE 
     149    .use_quickfilter = FALSE, 
     150    .qfilter_mode = QFILTER_CASE_INSENSITIVE 
    150151}; 
    151152 
    152153int easy_patterns = 1; 
    panels_load_options (void) 
    860861        panels_options.select_flags = 
    861862            mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, "select_flags", 
    862863                               (int) panels_options.select_flags); 
     864        qmode = mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
     865                                   "quick_filter_mode", (int) panels_options.qsearch_mode); 
     866 
     867        if (qmode < 0) 
     868            panels_options.qsearch_mode = QFILTER_CASE_INSENSITIVE; 
     869        else if (qmode >= QFILTER_NUM) 
     870            panels_options.qsearch_mode = QFILTER_CASE_INSENSITIVE; 
     871        else 
     872            panels_options.qsearch_mode = (qsearch_mode_t) qmode; 
    863873    } 
    864874} 
    865875 
    panels_save_options (void) 
    881891                       "quick_search_mode", (int) panels_options.qsearch_mode); 
    882892    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    883893                       "select_flags", (int) panels_options.select_flags); 
     894    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
     895                       "quick_filter_mode", (int) panels_options.qfilter_mode); 
    884896} 
    885897 
    886898/* --------------------------------------------------------------------------------------------- */ 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index 1576d4e..c8bc038 100644
    a b typedef enum 
    2929    QSEARCH_NUM 
    3030} qsearch_mode_t; 
    3131 
     32typedef enum 
     33{ 
     34    QFILTER_CASE_INSENSITIVE = 0,       /* quick filter in case insensitive mode */ 
     35    QFILTER_CASE_SENSITIVE = 1, /* quick filter in case sensitive mode */ 
     36    QFILTER_NUM 
     37} qfilter_mode_t; 
     38 
    3239/*** structures declarations (and typedefs of structures)*****************************************/ 
    3340 
    3441/* panels ini options; [Panels] section */ 
    typedef struct 
    5663    gboolean torben_fj_mode;    /* If TRUE, use some usability hacks by Torben */ 
    5764    panel_select_flags_t select_flags;  /* Select/unselect file flags */ 
    5865    gboolean use_quickfilter; 
     66    qfilter_mode_t qfilter_mode;        /* Quick search mode */ 
    5967} panels_options_t; 
    6068 
    6169typedef struct macro_action_t 
  • lib/search.h

    -- 
    2.9.0
    
    
    From aaba9c0472100c80bb24626771c0482af9513425 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:04:55 +0200
    Subject: [PATCH 08/30] Add a new function to start a case insensitive search.
     Have the case sensitive search call parametrized version
    
    ---
     lib/search.h        |  3 +++
     lib/search/search.c | 23 ++++++++++++++++++++---
     2 files changed, 23 insertions(+), 3 deletions(-)
    
    diff --git a/lib/search.h b/lib/search.h
    index 1c246c3..62ce34a 100644
    a b gchar **mc_search_get_types_strings_array (size_t * num); 
    164164gboolean mc_search (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
    165165                    mc_search_type_t type); 
    166166 
     167gboolean mc_search_case (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
     168                    mc_search_type_t type, gboolean case_insensitive); 
     169 
    167170int mc_search_getstart_result_by_num (mc_search_t *, int); 
    168171int mc_search_getend_result_by_num (mc_search_t *, int); 
    169172 
  • lib/search/search.c

    diff --git a/lib/search/search.c b/lib/search/search.c
    index af33b73..c8224cb 100644
    a b mc_search_is_fixed_search_str (mc_search_t * lc_mc_search) 
    405405} 
    406406 
    407407/* --------------------------------------------------------------------------------------------- */ 
    408 /* Search specified pattern in specified string. 
     408/* Search specified pattern case sensitive in specified string. 
    409409 * 
    410410 * @param pattern string to search 
    411411 * @param pattern_charset charset of #pattern. If NULL then cp_display will be used 
    mc_search_is_fixed_search_str (mc_search_t * lc_mc_search) 
    414414 * 
    415415 * @return TRUE if found is successful, FALSE otherwise. 
    416416 */ 
    417  
    418417gboolean 
    419418mc_search (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
    420419           mc_search_type_t type) 
    421420{ 
     421    return mc_search_case (pattern, pattern_charset, str, type, FALSE); 
     422} 
     423 
     424/* --------------------------------------------------------------------------------------------- */ 
     425/* Search specified pattern in specified string. 
     426 * 
     427 * @param pattern string to search 
     428 * @param pattern_charset charset of #pattern. If NULL then cp_display will be used 
     429 * @param str string where search #pattern 
     430 * @param search type (normal, regex, hex or glob) 
     431 * @param search case insensitive 
     432 * 
     433 * @return TRUE if found is successful, FALSE otherwise. 
     434 */ 
     435gboolean 
     436mc_search_case (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
     437           mc_search_type_t type, gboolean case_insensitive) 
     438{ 
    422439    gboolean ret; 
    423440    mc_search_t *search; 
    424441 
    mc_search (const gchar * pattern, const gchar * pattern_charset, const gchar * s 
    430447        return FALSE; 
    431448 
    432449    search->search_type = type; 
    433     search->is_case_sensitive = TRUE; 
     450    search->is_case_sensitive = !case_insensitive; 
    434451 
    435452    if (type == MC_SEARCH_T_GLOB) 
    436453        search->is_entire_line = TRUE; 
  • src/setup.c

    -- 
    2.9.0
    
    
    From f13adeaf45c1278e581d03ceafb196211493e2f8 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:05:31 +0200
    Subject: [PATCH 09/30] Fix qfilter_mode not being restored correctly bug.
    
    ---
     src/setup.c | 10 ++++------
     1 file changed, 4 insertions(+), 6 deletions(-)
    
    diff --git a/src/setup.c b/src/setup.c
    index 7d1fe16..f8e2281 100644
    a b panels_options_t panels_options = { 
    147147    .torben_fj_mode = FALSE, 
    148148    .select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS, 
    149149    .use_quickfilter = FALSE, 
    150     .qfilter_mode = QFILTER_CASE_INSENSITIVE 
     150    .qfilter_mode = QFILTER_CASE_SENSITIVE 
    151151}; 
    152152 
    153153int easy_patterns = 1; 
    panels_load_options (void) 
    864864        qmode = mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    865865                                   "quick_filter_mode", (int) panels_options.qsearch_mode); 
    866866 
    867         if (qmode < 0) 
    868             panels_options.qsearch_mode = QFILTER_CASE_INSENSITIVE; 
    869         else if (qmode >= QFILTER_NUM) 
    870             panels_options.qsearch_mode = QFILTER_CASE_INSENSITIVE; 
     867        if (qmode == QSEARCH_CASE_INSENSITIVE) 
     868            panels_options.qfilter_mode = QSEARCH_CASE_INSENSITIVE; 
    871869        else 
    872             panels_options.qsearch_mode = (qsearch_mode_t) qmode; 
     870            panels_options.qfilter_mode = QSEARCH_CASE_SENSITIVE; 
    873871    } 
    874872} 
    875873 
  • src/filemanager/dir.c

    -- 
    2.9.0
    
    
    From 7bf62a2528af57d17c70255688cbe2143adebfb4 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:06:16 +0200
    Subject: [PATCH 10/30] Add capability of applying case insensitive filter
    
    ---
     src/filemanager/dir.c   |  8 ++++--
     src/filemanager/panel.c | 66 +++++++++++++++++++++++++++++++++++++++++--------
     2 files changed, 62 insertions(+), 12 deletions(-)
    
    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index ad539d4..b436285 100644
    a b handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    150150               int *stale_link) 
    151151{ 
    152152    vfs_path_t *vpath; 
    153     gboolean add_directory; 
     153    gboolean add_directory, case_insensitive_filter; 
    154154 
    155155    if (DIR_IS_DOT (dp->d_name) || DIR_IS_DOTDOT (dp->d_name)) 
    156156        return FALSE; 
    handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    191191    add_directory = false; 
    192192    if(!filter_dirs) 
    193193        add_directory = S_ISDIR (buf1->st_mode); 
     194    case_insensitive_filter = FALSE; 
     195    if(panels_options.qfilter_mode == QFILTER_CASE_INSENSITIVE) 
     196        case_insensitive_filter = TRUE; 
    194197 
    195198    return (add_directory || *link_to_dir != 0 || fltr == NULL 
    196             || mc_search (fltr, NULL, dp->d_name, MC_SEARCH_T_GLOB)); 
     199            || mc_search_case (fltr, NULL, dp->d_name, MC_SEARCH_T_GLOB, 
     200                case_insensitive_filter)); 
    197201} 
    198202 
    199203/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index d63513e..b73efe6 100644
    a b stop_search (WPanel * panel) 
    27812781 
    27822782/* --------------------------------------------------------------------------------------------- */ 
    27832783 
    2784 static void 
     2784static gboolean 
    27852785apply_quickpanel_filter (WPanel * p) 
    27862786{ 
    27872787    size_t l, fl; 
    2788     g_free (p->filter); 
    2789     p->filter = 0; 
     2788    int i; 
     2789    char* new_filter; 
     2790    mc_search_t *search; 
     2791    gboolean is_found; 
     2792 
    27902793 
    27912794    l = strlen(p->quickfilter_buffer); 
    27922795    fl = l + 2 + 1; // + 2 for *<filter>*, 1 for trailing \0 
    2793     p->filter = g_malloc(fl); 
    2794     if(p->filter != NULL) 
     2796    new_filter = g_malloc(fl); 
     2797 
     2798    //if malloc fails, applying the new filter also fails 
     2799    if(new_filter == NULL) 
     2800        return FALSE; 
     2801 
     2802    new_filter[0] = '*'; 
     2803    memcpy(new_filter + 1, p->quickfilter_buffer, l); 
     2804    new_filter[fl - 2] = '*'; 
     2805    new_filter[fl - 1] = '\0'; 
     2806 
     2807    //First check if search would result in empty directory 
     2808    search = mc_search_new (new_filter, NULL); 
     2809    search->search_type = MC_SEARCH_T_GLOB; 
     2810    search->is_entire_line = TRUE; 
     2811 
     2812    switch (panels_options.qfilter_mode) 
     2813    { 
     2814    case QFILTER_CASE_SENSITIVE: 
     2815        search->is_case_sensitive = TRUE; 
     2816        break; 
     2817    case QFILTER_CASE_INSENSITIVE: 
     2818        search->is_case_sensitive = FALSE; 
     2819        break; 
     2820    default: 
     2821        search->is_case_sensitive = TRUE; 
     2822        break; 
     2823    } 
     2824 
     2825    is_found = FALSE; 
     2826    for (i = 0;  i < p->dir.len; ++i) 
     2827    { 
     2828        if (mc_search_run (search, p->dir.list[i].fname, 0, p->dir.list[i].fnamelen, NULL)) 
     2829        { 
     2830            is_found = TRUE; 
     2831            break; 
     2832        } 
     2833    } 
     2834 
     2835    if(!is_found) 
    27952836    { 
    2796         p->filter[0] = '*'; 
    2797         memcpy(p->filter + 1, p->quickfilter_buffer, l); 
    2798         p->filter[fl - 2] = '*'; 
    2799         p->filter[fl - 1] = '\0'; 
     2837        g_free(new_filter); 
     2838        return FALSE; 
    28002839    } 
    28012840 
     2841    g_free (p->filter); 
     2842    p->filter = new_filter; 
     2843 
    28022844    reread_cmd (); 
     2845    return TRUE; 
    28032846} 
    28042847 
    28052848static void 
    do_quickfilter(WPanel * panel, int key) 
    28362879        panel->quickfilter_buffer[l] = (char) key; 
    28372880        panel->quickfilter_buffer[l + 1] = '\0'; 
    28382881    } 
    2839     apply_quickpanel_filter(panel); 
     2882    if (!apply_quickpanel_filter(panel) && key != KEY_BACKSPACE) 
     2883    { 
     2884        panel->quickfilter_buffer[l] = '\0'; 
     2885    } 
    28402886} 
    28412887 
    28422888static void 
  • src/filemanager/boxes.c

    -- 
    2.9.0
    
    
    From 200d41f17420dd71f2942b2b0959016ca079f66f Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:07:13 +0200
    Subject: [PATCH 11/30] Rename option so it is more fitting for the implemented
     behavior
    
    ---
     src/filemanager/boxes.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 7358ce4..b9b3c5b 100644
    a b panel_options_box (void) 
    659659                    QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode, 
    660660                                 NULL), 
    661661                QUICK_STOP_GROUPBOX, 
    662                 QUICK_START_GROUPBOX (N_("Quick filter")), 
     662                QUICK_START_GROUPBOX (N_("Filter case")), 
    663663                    QUICK_RADIO (QFILTER_NUM, qfilter_options, (int *) &panels_options.qfilter_mode, 
    664664                                 NULL), 
    665665                QUICK_STOP_GROUPBOX, 
  • src/filemanager/boxes.c

    -- 
    2.9.0
    
    
    From c83995e803feddca6bb76ed568ba9b47b6fe418c Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:19:54 +0200
    Subject: [PATCH 12/30] rename qfilter_mode to filter_mode due to different
     semantics
    
    ---
     src/filemanager/boxes.c |  2 +-
     src/filemanager/dir.c   |  2 +-
     src/filemanager/panel.c |  2 +-
     src/setup.c             | 10 +++++-----
     src/setup.h             |  4 ++--
     5 files changed, 10 insertions(+), 10 deletions(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index b9b3c5b..153ec0c 100644
    a b panel_options_box (void) 
    660660                                 NULL), 
    661661                QUICK_STOP_GROUPBOX, 
    662662                QUICK_START_GROUPBOX (N_("Filter case")), 
    663                     QUICK_RADIO (QFILTER_NUM, qfilter_options, (int *) &panels_options.qfilter_mode, 
     663                    QUICK_RADIO (QFILTER_NUM, qfilter_options, (int *) &panels_options.filter_mode, 
    664664                                 NULL), 
    665665                QUICK_STOP_GROUPBOX, 
    666666            QUICK_STOP_COLUMNS, 
  • src/filemanager/dir.c

    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index b436285..2872f7f 100644
    a b handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    192192    if(!filter_dirs) 
    193193        add_directory = S_ISDIR (buf1->st_mode); 
    194194    case_insensitive_filter = FALSE; 
    195     if(panels_options.qfilter_mode == QFILTER_CASE_INSENSITIVE) 
     195    if(panels_options.filter_mode == QFILTER_CASE_INSENSITIVE) 
    196196        case_insensitive_filter = TRUE; 
    197197 
    198198    return (add_directory || *link_to_dir != 0 || fltr == NULL 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index b73efe6..9b1f78b 100644
    a b apply_quickpanel_filter (WPanel * p) 
    28092809    search->search_type = MC_SEARCH_T_GLOB; 
    28102810    search->is_entire_line = TRUE; 
    28112811 
    2812     switch (panels_options.qfilter_mode) 
     2812    switch (panels_options.filter_mode) 
    28132813    { 
    28142814    case QFILTER_CASE_SENSITIVE: 
    28152815        search->is_case_sensitive = TRUE; 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index f8e2281..dfbb64f 100644
    a b panels_options_t panels_options = { 
    147147    .torben_fj_mode = FALSE, 
    148148    .select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS, 
    149149    .use_quickfilter = FALSE, 
    150     .qfilter_mode = QFILTER_CASE_SENSITIVE 
     150    .filter_mode = QFILTER_CASE_SENSITIVE 
    151151}; 
    152152 
    153153int easy_patterns = 1; 
    panels_load_options (void) 
    864864        qmode = mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    865865                                   "quick_filter_mode", (int) panels_options.qsearch_mode); 
    866866 
    867         if (qmode == QSEARCH_CASE_INSENSITIVE) 
    868             panels_options.qfilter_mode = QSEARCH_CASE_INSENSITIVE; 
     867        if (qmode == QFILTER_CASE_INSENSITIVE) 
     868            panels_options.filter_mode = QFILTER_CASE_INSENSITIVE; 
    869869        else 
    870             panels_options.qfilter_mode = QSEARCH_CASE_SENSITIVE; 
     870            panels_options.filter_mode = QFILTER_CASE_SENSITIVE; 
    871871    } 
    872872} 
    873873 
    panels_save_options (void) 
    890890    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    891891                       "select_flags", (int) panels_options.select_flags); 
    892892    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    893                        "quick_filter_mode", (int) panels_options.qfilter_mode); 
     893                       "quick_filter_mode", (int) panels_options.filter_mode); 
    894894} 
    895895 
    896896/* --------------------------------------------------------------------------------------------- */ 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index c8bc038..e8e7a11 100644
    a b typedef enum 
    3434    QFILTER_CASE_INSENSITIVE = 0,       /* quick filter in case insensitive mode */ 
    3535    QFILTER_CASE_SENSITIVE = 1, /* quick filter in case sensitive mode */ 
    3636    QFILTER_NUM 
    37 } qfilter_mode_t; 
     37} filter_mode_t; 
    3838 
    3939/*** structures declarations (and typedefs of structures)*****************************************/ 
    4040 
    typedef struct 
    6363    gboolean torben_fj_mode;    /* If TRUE, use some usability hacks by Torben */ 
    6464    panel_select_flags_t select_flags;  /* Select/unselect file flags */ 
    6565    gboolean use_quickfilter; 
    66     qfilter_mode_t qfilter_mode;        /* Quick search mode */ 
     66    filter_mode_t filter_mode;        /* Quick search mode */ 
    6767} panels_options_t; 
    6868 
    6969typedef struct macro_action_t 
  • src/setup.c

    -- 
    2.9.0
    
    
    From 0273aaf89d65891fc157a827db24a55dfe309339 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:20:24 +0200
    Subject: [PATCH 13/30] Rename filter_mode save string
    
    ---
     src/setup.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/setup.c b/src/setup.c
    index dfbb64f..5847505 100644
    a b panels_load_options (void) 
    862862            mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, "select_flags", 
    863863                               (int) panels_options.select_flags); 
    864864        qmode = mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    865                                    "quick_filter_mode", (int) panels_options.qsearch_mode); 
     865                                   "filter_mode", (int) panels_options.qsearch_mode); 
    866866 
    867867        if (qmode == QFILTER_CASE_INSENSITIVE) 
    868868            panels_options.filter_mode = QFILTER_CASE_INSENSITIVE; 
    panels_save_options (void) 
    890890    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    891891                       "select_flags", (int) panels_options.select_flags); 
    892892    mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION, 
    893                        "quick_filter_mode", (int) panels_options.filter_mode); 
     893                       "filter_mode", (int) panels_options.filter_mode); 
    894894} 
    895895 
    896896/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/cmd.c

    -- 
    2.9.0
    
    
    From 1fa7783f3c8d1efeb0f923075a7d9effa85c9ce4 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 19:34:21 +0200
    Subject: [PATCH 14/30] Applying the filter via the menu overrides the
     quickfilter
    
    ---
     src/filemanager/cmd.c   |  1 +
     src/filemanager/panel.c | 42 +++++++++++++++++++++++++++---------------
     src/filemanager/panel.h |  2 ++
     3 files changed, 30 insertions(+), 15 deletions(-)
    
    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 1884589..4608010 100644
    a b do_edit (const vfs_path_t * what_vpath) 
    171171static void 
    172172set_panel_filter_to (WPanel * p, char *allocated_filter_string) 
    173173{ 
     174    stop_quickfilter(p); 
    174175    g_free (p->filter); 
    175176    p->filter = 0; 
    176177 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 9b1f78b..6b97aa9 100644
    a b stop_search (WPanel * panel) 
    27802780} 
    27812781 
    27822782/* --------------------------------------------------------------------------------------------- */ 
     2783/* Try to apply the quickfilter_buffer to the current directory. 
     2784 * Checks that applying the filter will not result in an empty directory. 
     2785 * 
     2786 * @return TRUE if it could be applied, FALSE otherwise. 
     2787 */ 
    27832788 
    27842789static gboolean 
    27852790apply_quickpanel_filter (WPanel * p) 
    apply_quickpanel_filter (WPanel * p) 
    28452850    return TRUE; 
    28462851} 
    28472852 
    2848 static void 
    2849 stop_quickfilter(WPanel * panel) 
    2850 { 
    2851     if (!panel->quickfiltering) 
    2852     { 
    2853         return; 
    2854     } 
    2855     panel->quickfiltering = FALSE; 
    2856     panel->quickfilter_buffer[0] = '\0'; 
    2857     g_free(panel->filter); 
    2858     panel->filter = 0; 
    2859     reread_cmd (); 
    2860 } 
     2853/* --------------------------------------------------------------------------------------------- */ 
    28612854 
    28622855static void 
    28632856do_quickfilter(WPanel * panel, int key) 
    do_quickfilter(WPanel * panel, int key) 
    28852878    } 
    28862879} 
    28872880 
     2881/* --------------------------------------------------------------------------------------------- */ 
     2882 
    28882883static void 
    28892884start_quickfilter(WPanel * panel) 
    28902885{ 
    panel_key (WPanel * panel, int key) 
    37673762        { 
    37683763            start_search (panel); 
    37693764            do_search (panel, key); 
     3765            return MSG_HANDLED; 
    37703766        } 
    3771         else 
     3767        else if(panel->filter == NULL) 
    37723768        { 
    37733769            start_quickfilter(panel); 
    37743770            do_quickfilter(panel, key); 
     3771            return MSG_HANDLED; 
    37753772        } 
    3776         return MSG_HANDLED; 
    37773773    } 
    37783774 
    37793775    return MSG_NOT_HANDLED; 
    do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact) 
    52195215} 
    52205216 
    52215217/* --------------------------------------------------------------------------------------------- */ 
     5218 
     5219void 
     5220stop_quickfilter(WPanel * panel) 
     5221{ 
     5222    if (!panel->quickfiltering) 
     5223    { 
     5224        return; 
     5225    } 
     5226    panel->quickfiltering = FALSE; 
     5227    panel->quickfilter_buffer[0] = '\0'; 
     5228    g_free(panel->filter); 
     5229    panel->filter = 0; 
     5230    reread_cmd (); 
     5231} 
     5232 
     5233/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/panel.h

    diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h
    index 0aa75f8..955cb6b 100644
    a b void panel_init (void); 
    196196void panel_deinit (void); 
    197197gboolean do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); 
    198198 
     199void stop_quickfilter(WPanel * panel); 
     200 
    199201/* --------------------------------------------------------------------------------------------- */ 
    200202/*** inline functions ****************************************************************************/ 
    201203/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/boxes.c

    -- 
    2.9.0
    
    
    From 3dd5a28cefb8fc4fb76e8f29c7f7ba98f1e2b068 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 20:42:22 +0200
    Subject: [PATCH 15/30] Add an options for applying filter to .. directory
    
    ---
     src/filemanager/boxes.c | 2 +-
     src/setup.c             | 2 ++
     src/setup.h             | 1 +
     3 files changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 153ec0c..04833df 100644
    a b configure_box (void) 
    520520                    QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), 
    521521                    QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), 
    522522                    QUICK_CHECKBOX (N_("Filter directories"), &filter_dirs, NULL), 
    523                     QUICK_SEPARATOR (FALSE), 
     523                    QUICK_CHECKBOX (N_("Filter .. directory"), &filter_dotdot_dir, NULL), 
    524524                    QUICK_SEPARATOR (FALSE), 
    525525                QUICK_STOP_GROUPBOX, 
    526526            QUICK_STOP_COLUMNS, 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 5847505..943aedf 100644
    a b int use_file_to_check_type = 1; 
    172172int verbose = 1; 
    173173 
    174174int filter_dirs = 0; 
     175int filter_dotdot_dir = 0; 
    175176 
    176177/* 
    177178 * Whether the Midnight Commander tries to provide more 
    static const struct 
    372373    { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, 
    373374    { "copymove_persistent_attr", &setup_copymove_persistent_attr }, 
    374375    { "filter_dirs", &filter_dirs }, 
     376    { "filter_dotdot_dir", &filter_dotdot_dir }, 
    375377    { NULL, NULL } 
    376378}; 
    377379 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index e8e7a11..4507ad3 100644
    a b struct mc_fhl_struct; 
    8686extern char *global_profile_name; 
    8787extern int confirm_delete; 
    8888extern int filter_dirs; 
     89extern int filter_dotdot_dir; 
    8990extern int confirm_directory_hotlist_delete; 
    9091extern int confirm_execute; 
    9192extern int confirm_exit; 
  • src/filemanager/cmd.c

    -- 
    2.9.0
    
    
    From 00e6a7e52835f146f222471d182d9f9badde3301 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 20:44:20 +0200
    Subject: [PATCH 16/30] Allow filtering of .. directory. Couple of bugfixes
     resulting from filtering ..
    
    ---
     src/filemanager/cmd.c   |  2 +-
     src/filemanager/dir.c   | 31 ++++++++++++++++++++++---------
     src/filemanager/dir.h   |  1 +
     src/filemanager/panel.c | 37 ++++++++++++++++---------------------
     src/filemanager/panel.h |  2 +-
     5 files changed, 41 insertions(+), 32 deletions(-)
    
    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 4608010..4ffdd9d 100644
    a b do_edit (const vfs_path_t * what_vpath) 
    171171static void 
    172172set_panel_filter_to (WPanel * p, char *allocated_filter_string) 
    173173{ 
    174     stop_quickfilter(p); 
     174    stop_quickfilter(p, FALSE); 
    175175    g_free (p->filter); 
    176176    p->filter = 0; 
    177177 
  • src/filemanager/dir.c

    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index 2872f7f..a3979af 100644
    a b handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    190190 
    191191    add_directory = false; 
    192192    if(!filter_dirs) 
    193         add_directory = S_ISDIR (buf1->st_mode); 
     193        add_directory = S_ISDIR (buf1->st_mode) || *link_to_dir != 0; 
    194194    case_insensitive_filter = FALSE; 
    195195    if(panels_options.filter_mode == QFILTER_CASE_INSENSITIVE) 
    196196        case_insensitive_filter = TRUE; 
    197197 
    198     return (add_directory || *link_to_dir != 0 || fltr == NULL 
    199             || mc_search_case (fltr, NULL, dp->d_name, MC_SEARCH_T_GLOB, 
    200                 case_insensitive_filter)); 
     198    return (add_directory || fltr == NULL || 
     199            mc_search_case (fltr, NULL, dp->d_name, MC_SEARCH_T_GLOB, case_insensitive_filter)); 
    201200} 
    202201 
    203202/* --------------------------------------------------------------------------------------------- */ 
    dir_list_clean (dir_list * list) 
    555554} 
    556555 
    557556/* --------------------------------------------------------------------------------------------- */ 
    558 /** Used to set up a directory list when there is no access to a directory */ 
    559557 
    560558gboolean 
    561559dir_list_init (dir_list * list) 
    562560{ 
     561    return dir_list_init_general(list, NULL); 
     562} 
     563 
     564/* --------------------------------------------------------------------------------------------- */ 
     565/** Used to set up a directory list when there is no access to a directory */ 
     566 
     567gboolean 
     568dir_list_init_general (dir_list * list, const char *fltr) 
     569{ 
    563570    file_entry_t *fentry; 
    564571 
    565572    /* Need to grow the *list? */ 
    dir_list_init (dir_list * list) 
    569576        return FALSE; 
    570577    } 
    571578 
     579    if(filter_dotdot_dir && fltr && !mc_search(fltr, NULL, "..", MC_SEARCH_T_GLOB)) 
     580    { 
     581        list->len = 0; 
     582        return TRUE; 
     583    } 
    572584    fentry = &list->list[0]; 
    573585    memset (fentry, 0, sizeof (*fentry)); 
    574586    fentry->fnamelen = 2; 
    dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    641653    const char *vpath_str; 
    642654 
    643655    /* ".." (if any) must be the first entry in the list */ 
    644     if (!dir_list_init (list)) 
     656    if (!dir_list_init_general (list, fltr)) 
    645657        return; 
    646658 
    647659    fentry = &list->list[0]; 
    648     if (dir_get_dotdot_stat (vpath, &st)) 
     660    if (list->len > 0 && dir_get_dotdot_stat (vpath, &st)) 
    649661        fentry->st = st; 
    650662 
    651663    dirp = mc_opendir (vpath); 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    758770    else 
    759771    { 
    760772        dir_list_clean (list); 
    761         if (!dir_list_init (list)) 
     773 
     774        if (!dir_list_init_general (list, fltr)) 
    762775        { 
    763776            dir_list_clean (&dir_copy); 
    764777            return; 
    765778        } 
    766779 
    767         if (dir_get_dotdot_stat (vpath, &st)) 
     780        if (list->len > 0 && dir_get_dotdot_stat (vpath, &st)) 
    768781        { 
    769782            file_entry_t *fentry; 
    770783 
  • src/filemanager/dir.h

    diff --git a/src/filemanager/dir.h b/src/filemanager/dir.h
    index a87e92d..8d72257 100644
    a b void dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc so 
    5454                      const dir_sort_options_t * sort_op, const char *fltr); 
    5555void dir_list_sort (dir_list * list, GCompareFunc sort, const dir_sort_options_t * sort_op); 
    5656gboolean dir_list_init (dir_list * list); 
     57gboolean dir_list_init_general (dir_list * list, const char *fltr); 
    5758void dir_list_clean (dir_list * list); 
    5859gboolean handle_path (const char *path, struct stat *buf1, int *link_to_dir, int *stale_link); 
    5960 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 6b97aa9..3bd114c 100644
    a b do_quickfilter(WPanel * panel, int key) 
    28612861    { 
    28622862        if (l <= 1) 
    28632863        { 
    2864             stop_quickfilter(panel); 
     2864            stop_quickfilter(panel, TRUE); 
    28652865            return; 
    28662866        } 
    28672867        panel->quickfilter_buffer[l - 1] = '\0'; 
    directory_history_list (WPanel * panel) 
    34833483    gboolean ok = FALSE; 
    34843484    size_t pos; 
    34853485 
    3486     pos = g_list_position (panel->dir_history_current, panel->dir_history); 
     3486        pos = g_list_position (panel->dir_history_current, panel->dir_history); 
    34873487 
    34883488    s = history_show (&panel->dir_history, WIDGET (panel), pos); 
    34893489    if (s != NULL) 
    directory_history_list (WPanel * panel) 
    35273527static cb_ret_t 
    35283528panel_execute_cmd (WPanel * panel, long command) 
    35293529{ 
    3530     gboolean bstop_quickfilter = FALSE; 
    35313530    int res = MSG_HANDLED; 
    35323531 
    35333532    if (command != CK_Search) 
    panel_execute_cmd (WPanel * panel, long command) 
    35533552    switch (command) 
    35543553    { 
    35553554    case CK_PanelOtherCd: 
     3555        stop_quickfilter(panel, FALSE); 
    35563556        chdir_other_panel (panel); 
    3557         bstop_quickfilter = TRUE; 
    35583557        break; 
    35593558    case CK_PanelOtherCdLink: 
     3559        stop_quickfilter(panel, FALSE); 
    35603560        chdir_to_readlink (panel); 
    3561         bstop_quickfilter = TRUE; 
    35623561        break; 
    35633562    case CK_CopySingle: 
    35643563        copy_cmd_local (); 
    panel_execute_cmd (WPanel * panel, long command) 
    35673566        delete_cmd_local (); 
    35683567        break; 
    35693568    case CK_Enter: 
     3569        stop_quickfilter(panel, FALSE); 
    35703570        do_enter (panel); 
    3571         bstop_quickfilter = TRUE; 
    35723571        break; 
    35733572    case CK_ViewRaw: 
    35743573        view_raw_cmd (); 
    panel_execute_cmd (WPanel * panel, long command) 
    35983597        prev_page (panel); 
    35993598        break; 
    36003599    case CK_CdChild: 
     3600        stop_quickfilter(panel, FALSE); 
    36013601        goto_child_dir (panel); 
    3602         bstop_quickfilter = TRUE; 
    36033602        break; 
    36043603    case CK_CdParent: 
     3604        stop_quickfilter(panel, FALSE); 
    36053605        goto_parent_dir (panel); 
    3606         bstop_quickfilter = TRUE; 
    36073606        break; 
    36083607    case CK_History: 
    36093608        directory_history_list (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    36393638        mark_file_right (panel); 
    36403639        break; 
    36413640    case CK_CdParentSmart: 
     3641        stop_quickfilter(panel, FALSE); 
    36423642        res = force_maybe_cd (); 
    3643         bstop_quickfilter = TRUE; 
    36443643        break; 
    36453644    case CK_Up: 
    36463645        move_up (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    36493648        move_down (panel); 
    36503649        break; 
    36513650    case CK_Left: 
     3651        stop_quickfilter(panel, FALSE); 
    36523652        res = move_left (panel); 
    3653         bstop_quickfilter = TRUE; 
    36543653        break; 
    36553654    case CK_Right: 
     3655        stop_quickfilter(panel, FALSE); 
    36563656        res = move_right (panel); 
    3657         bstop_quickfilter = TRUE; 
    36583657        break; 
    36593658    case CK_Bottom: 
    36603659        move_end (panel); 
    panel_execute_cmd (WPanel * panel, long command) 
    36643663        break; 
    36653664#ifdef HAVE_CHARSET 
    36663665    case CK_SelectCodepage: 
     3666        stop_quickfilter(panel, FALSE); 
    36673667        panel_change_encoding (panel); 
    3668         bstop_quickfilter = TRUE; 
    36693668        break; 
    36703669#endif 
    36713670    case CK_ScrollLeft: 
    panel_execute_cmd (WPanel * panel, long command) 
    36753674        panel_content_scroll_right (panel); 
    36763675        break; 
    36773676    case CK_Search: 
     3677        stop_quickfilter(panel, FALSE); 
    36783678        start_search (panel); 
    3679         bstop_quickfilter = TRUE; 
    36803679        break; 
    36813680    case CK_SearchStop: 
    36823681        break; 
    panel_execute_cmd (WPanel * panel, long command) 
    37133712        break; 
    37143713    } 
    37153714 
    3716     if(bstop_quickfilter) 
    3717     { 
    3718         stop_quickfilter(panel); 
    3719     } 
    3720  
    37213715    return res; 
    37223716} 
    37233717 
    do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact) 
    52175211/* --------------------------------------------------------------------------------------------- */ 
    52185212 
    52195213void 
    5220 stop_quickfilter(WPanel * panel) 
     5214stop_quickfilter(WPanel * panel, gboolean redraw) 
    52215215{ 
    52225216    if (!panel->quickfiltering) 
    52235217    { 
    stop_quickfilter(WPanel * panel) 
    52255219    } 
    52265220    panel->quickfiltering = FALSE; 
    52275221    panel->quickfilter_buffer[0] = '\0'; 
    5228     g_free(panel->filter); 
     5222    g_free (panel->filter); 
    52295223    panel->filter = 0; 
    5230     reread_cmd (); 
     5224    if(redraw) 
     5225        reread_cmd (); 
    52315226} 
    52325227 
    52335228/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/panel.h

    diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h
    index 955cb6b..4a294fe 100644
    a b void panel_init (void); 
    196196void panel_deinit (void); 
    197197gboolean do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); 
    198198 
    199 void stop_quickfilter(WPanel * panel); 
     199void stop_quickfilter(WPanel * panel, gboolean redraw); 
    200200 
    201201/* --------------------------------------------------------------------------------------------- */ 
    202202/*** inline functions ****************************************************************************/ 
  • src/filemanager/dir.c

    -- 
    2.9.0
    
    
    From 702c5fbdf55537c91362d94f6f3d0878f470c9e3 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 21:03:09 +0200
    Subject: [PATCH 17/30] Add .. if resulting dirlist would be empty to avoid
     problems w.r.t empty panels
    
    ---
     src/filemanager/dir.c | 24 ++++++++++++++++++------
     src/filemanager/dir.h |  2 +-
     2 files changed, 19 insertions(+), 7 deletions(-)
    
    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index a3979af..aa588ef 100644
    a b dir_list_clean (dir_list * list) 
    558558gboolean 
    559559dir_list_init (dir_list * list) 
    560560{ 
    561     return dir_list_init_general(list, NULL); 
     561    return dir_list_init_filtered(list, NULL); 
    562562} 
    563563 
    564564/* --------------------------------------------------------------------------------------------- */ 
    565565/** Used to set up a directory list when there is no access to a directory */ 
    566566 
    567567gboolean 
    568 dir_list_init_general (dir_list * list, const char *fltr) 
     568dir_list_init_filtered (dir_list * list, const char *fltr) 
    569569{ 
    570570    file_entry_t *fentry; 
    571571 
    dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    653653    const char *vpath_str; 
    654654 
    655655    /* ".." (if any) must be the first entry in the list */ 
    656     if (!dir_list_init_general (list, fltr)) 
     656    if (!dir_list_init_filtered (list, fltr)) 
    657657        return; 
    658658 
    659659    fentry = &list->list[0]; 
    dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    685685        if ((list->len & 31) == 0) 
    686686            rotate_dash (TRUE); 
    687687    } 
    688  
     688    if (list->len == 0) 
     689    { 
     690        dir_list_init(list); 
     691        if( dir_get_dotdot_stat (vpath, &st)) 
     692            fentry->st = st; 
     693    } 
    689694    dir_list_sort (list, sort, sort_op); 
    690695 
    691696  ret: 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    771776    { 
    772777        dir_list_clean (list); 
    773778 
    774         if (!dir_list_init_general (list, fltr)) 
     779        if (!dir_list_init_filtered (list, fltr)) 
    775780        { 
    776781            dir_list_clean (&dir_copy); 
    777782            return; 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    780785        if (list->len > 0 && dir_get_dotdot_stat (vpath, &st)) 
    781786        { 
    782787            file_entry_t *fentry; 
    783  
    784788            fentry = &list->list[0]; 
    785789            fentry->st = st; 
    786790        } 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    832836    tree_store_end_check (); 
    833837    g_hash_table_destroy (marked_files); 
    834838 
     839    if (list->len == 0) 
     840    { 
     841        file_entry_t *fentry; 
     842        dir_list_init(list); 
     843        if( dir_get_dotdot_stat (vpath, &st)) 
     844            fentry->st = st; 
     845    } 
     846 
    835847    dir_list_sort (list, sort, sort_op); 
    836848 
    837849    dir_list_clean (&dir_copy); 
  • src/filemanager/dir.h

    diff --git a/src/filemanager/dir.h b/src/filemanager/dir.h
    index 8d72257..50f4eaa 100644
    a b void dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc so 
    5454                      const dir_sort_options_t * sort_op, const char *fltr); 
    5555void dir_list_sort (dir_list * list, GCompareFunc sort, const dir_sort_options_t * sort_op); 
    5656gboolean dir_list_init (dir_list * list); 
    57 gboolean dir_list_init_general (dir_list * list, const char *fltr); 
     57gboolean dir_list_init_filtered (dir_list * list, const char *fltr); 
    5858void dir_list_clean (dir_list * list); 
    5959gboolean handle_path (const char *path, struct stat *buf1, int *link_to_dir, int *stale_link); 
    6060 
  • lib/search.h

    -- 
    2.9.0
    
    
    From a740c06153201ed0c418160c01efaecc00e6b358 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 21:07:29 +0200
    Subject: [PATCH 18/30] Apply indent for coding style
    
    ---
     lib/search.h            |  2 +-
     lib/search/search.c     |  2 +-
     src/filemanager/cmd.c   |  2 +-
     src/filemanager/dir.c   | 16 ++++++------
     src/filemanager/panel.c | 68 ++++++++++++++++++++++++-------------------------
     src/filemanager/panel.h |  2 +-
     src/setup.h             |  2 +-
     7 files changed, 47 insertions(+), 47 deletions(-)
    
    diff --git a/lib/search.h b/lib/search.h
    index 62ce34a..17de592 100644
    a b gboolean mc_search (const gchar * pattern, const gchar * pattern_charset, const 
    165165                    mc_search_type_t type); 
    166166 
    167167gboolean mc_search_case (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
    168                     mc_search_type_t type, gboolean case_insensitive); 
     168                         mc_search_type_t type, gboolean case_insensitive); 
    169169 
    170170int mc_search_getstart_result_by_num (mc_search_t *, int); 
    171171int mc_search_getend_result_by_num (mc_search_t *, int); 
  • lib/search/search.c

    diff --git a/lib/search/search.c b/lib/search/search.c
    index c8224cb..a3ef871 100644
    a b mc_search (const gchar * pattern, const gchar * pattern_charset, const gchar * s 
    434434 */ 
    435435gboolean 
    436436mc_search_case (const gchar * pattern, const gchar * pattern_charset, const gchar * str, 
    437            mc_search_type_t type, gboolean case_insensitive) 
     437                mc_search_type_t type, gboolean case_insensitive) 
    438438{ 
    439439    gboolean ret; 
    440440    mc_search_t *search; 
  • src/filemanager/cmd.c

    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 4ffdd9d..171d06a 100644
    a b do_edit (const vfs_path_t * what_vpath) 
    171171static void 
    172172set_panel_filter_to (WPanel * p, char *allocated_filter_string) 
    173173{ 
    174     stop_quickfilter(p, FALSE); 
     174    stop_quickfilter (p, FALSE); 
    175175    g_free (p->filter); 
    176176    p->filter = 0; 
    177177 
  • src/filemanager/dir.c

    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index aa588ef..9e60e44 100644
    a b handle_dirent (struct dirent *dp, const char *fltr, struct stat *buf1, int *link 
    189189    vfs_path_free (vpath); 
    190190 
    191191    add_directory = false; 
    192     if(!filter_dirs) 
     192    if (!filter_dirs) 
    193193        add_directory = S_ISDIR (buf1->st_mode) || *link_to_dir != 0; 
    194194    case_insensitive_filter = FALSE; 
    195     if(panels_options.filter_mode == QFILTER_CASE_INSENSITIVE) 
     195    if (panels_options.filter_mode == QFILTER_CASE_INSENSITIVE) 
    196196        case_insensitive_filter = TRUE; 
    197197 
    198198    return (add_directory || fltr == NULL || 
    dir_list_clean (dir_list * list) 
    558558gboolean 
    559559dir_list_init (dir_list * list) 
    560560{ 
    561     return dir_list_init_filtered(list, NULL); 
     561    return dir_list_init_filtered (list, NULL); 
    562562} 
    563563 
    564564/* --------------------------------------------------------------------------------------------- */ 
    dir_list_init_filtered (dir_list * list, const char *fltr) 
    576576        return FALSE; 
    577577    } 
    578578 
    579     if(filter_dotdot_dir && fltr && !mc_search(fltr, NULL, "..", MC_SEARCH_T_GLOB)) 
     579    if (filter_dotdot_dir && fltr && !mc_search (fltr, NULL, "..", MC_SEARCH_T_GLOB)) 
    580580    { 
    581581        list->len = 0; 
    582582        return TRUE; 
    dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    687687    } 
    688688    if (list->len == 0) 
    689689    { 
    690         dir_list_init(list); 
    691         if( dir_get_dotdot_stat (vpath, &st)) 
     690        dir_list_init (list); 
     691        if (dir_get_dotdot_stat (vpath, &st)) 
    692692            fentry->st = st; 
    693693    } 
    694694    dir_list_sort (list, sort, sort_op); 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    839839    if (list->len == 0) 
    840840    { 
    841841        file_entry_t *fentry; 
    842         dir_list_init(list); 
    843         if( dir_get_dotdot_stat (vpath, &st)) 
     842        dir_list_init (list); 
     843        if (dir_get_dotdot_stat (vpath, &st)) 
    844844            fentry->st = st; 
    845845    } 
    846846 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 3bd114c..c9716a7 100644
    a b apply_quickpanel_filter (WPanel * p) 
    27912791{ 
    27922792    size_t l, fl; 
    27932793    int i; 
    2794     char* new_filter; 
     2794    char *new_filter; 
    27952795    mc_search_t *search; 
    27962796    gboolean is_found; 
    27972797 
    27982798 
    2799     l = strlen(p->quickfilter_buffer); 
    2800     fl = l + 2 + 1; // + 2 for *<filter>*, 1 for trailing \0 
    2801     new_filter = g_malloc(fl); 
     2799    l = strlen (p->quickfilter_buffer); 
     2800    fl = l + 2 + 1;             // + 2 for *<filter>*, 1 for trailing \0 
     2801    new_filter = g_malloc (fl); 
    28022802 
    28032803    //if malloc fails, applying the new filter also fails 
    2804     if(new_filter == NULL) 
     2804    if (new_filter == NULL) 
    28052805        return FALSE; 
    28062806 
    28072807    new_filter[0] = '*'; 
    2808     memcpy(new_filter + 1, p->quickfilter_buffer, l); 
     2808    memcpy (new_filter + 1, p->quickfilter_buffer, l); 
    28092809    new_filter[fl - 2] = '*'; 
    28102810    new_filter[fl - 1] = '\0'; 
    28112811 
    apply_quickpanel_filter (WPanel * p) 
    28282828    } 
    28292829 
    28302830    is_found = FALSE; 
    2831     for (i = 0;  i < p->dir.len; ++i) 
     2831    for (i = 0; i < p->dir.len; ++i) 
    28322832    { 
    28332833        if (mc_search_run (search, p->dir.list[i].fname, 0, p->dir.list[i].fnamelen, NULL)) 
    28342834        { 
    apply_quickpanel_filter (WPanel * p) 
    28372837        } 
    28382838    } 
    28392839 
    2840     if(!is_found) 
     2840    if (!is_found) 
    28412841    { 
    2842         g_free(new_filter); 
     2842        g_free (new_filter); 
    28432843        return FALSE; 
    28442844    } 
    28452845 
    apply_quickpanel_filter (WPanel * p) 
    28532853/* --------------------------------------------------------------------------------------------- */ 
    28542854 
    28552855static void 
    2856 do_quickfilter(WPanel * panel, int key) 
     2856do_quickfilter (WPanel * panel, int key) 
    28572857{ 
    28582858    size_t l; 
    2859     l = strlen(panel->quickfilter_buffer); 
    2860     if(key == KEY_BACKSPACE) 
     2859    l = strlen (panel->quickfilter_buffer); 
     2860    if (key == KEY_BACKSPACE) 
    28612861    { 
    28622862        if (l <= 1) 
    28632863        { 
    2864             stop_quickfilter(panel, TRUE); 
     2864            stop_quickfilter (panel, TRUE); 
    28652865            return; 
    28662866        } 
    28672867        panel->quickfilter_buffer[l - 1] = '\0'; 
    do_quickfilter(WPanel * panel, int key) 
    28722872        panel->quickfilter_buffer[l] = (char) key; 
    28732873        panel->quickfilter_buffer[l + 1] = '\0'; 
    28742874    } 
    2875     if (!apply_quickpanel_filter(panel) && key != KEY_BACKSPACE) 
     2875    if (!apply_quickpanel_filter (panel) && key != KEY_BACKSPACE) 
    28762876    { 
    28772877        panel->quickfilter_buffer[l] = '\0'; 
    28782878    } 
    do_quickfilter(WPanel * panel, int key) 
    28812881/* --------------------------------------------------------------------------------------------- */ 
    28822882 
    28832883static void 
    2884 start_quickfilter(WPanel * panel) 
     2884start_quickfilter (WPanel * panel) 
    28852885{ 
    28862886    if (panel->quickfiltering || panel->filter == NULL) 
    28872887        panel->quickfiltering = TRUE; 
    directory_history_list (WPanel * panel) 
    34833483    gboolean ok = FALSE; 
    34843484    size_t pos; 
    34853485 
    3486         pos = g_list_position (panel->dir_history_current, panel->dir_history); 
     3486    pos = g_list_position (panel->dir_history_current, panel->dir_history); 
    34873487 
    34883488    s = history_show (&panel->dir_history, WIDGET (panel), pos); 
    34893489    if (s != NULL) 
    panel_execute_cmd (WPanel * panel, long command) 
    35523552    switch (command) 
    35533553    { 
    35543554    case CK_PanelOtherCd: 
    3555         stop_quickfilter(panel, FALSE); 
     3555        stop_quickfilter (panel, FALSE); 
    35563556        chdir_other_panel (panel); 
    35573557        break; 
    35583558    case CK_PanelOtherCdLink: 
    3559         stop_quickfilter(panel, FALSE); 
     3559        stop_quickfilter (panel, FALSE); 
    35603560        chdir_to_readlink (panel); 
    35613561        break; 
    35623562    case CK_CopySingle: 
    panel_execute_cmd (WPanel * panel, long command) 
    35663566        delete_cmd_local (); 
    35673567        break; 
    35683568    case CK_Enter: 
    3569         stop_quickfilter(panel, FALSE); 
     3569        stop_quickfilter (panel, FALSE); 
    35703570        do_enter (panel); 
    35713571        break; 
    35723572    case CK_ViewRaw: 
    panel_execute_cmd (WPanel * panel, long command) 
    35973597        prev_page (panel); 
    35983598        break; 
    35993599    case CK_CdChild: 
    3600         stop_quickfilter(panel, FALSE); 
     3600        stop_quickfilter (panel, FALSE); 
    36013601        goto_child_dir (panel); 
    36023602        break; 
    36033603    case CK_CdParent: 
    3604         stop_quickfilter(panel, FALSE); 
     3604        stop_quickfilter (panel, FALSE); 
    36053605        goto_parent_dir (panel); 
    36063606        break; 
    36073607    case CK_History: 
    panel_execute_cmd (WPanel * panel, long command) 
    36383638        mark_file_right (panel); 
    36393639        break; 
    36403640    case CK_CdParentSmart: 
    3641         stop_quickfilter(panel, FALSE); 
     3641        stop_quickfilter (panel, FALSE); 
    36423642        res = force_maybe_cd (); 
    36433643        break; 
    36443644    case CK_Up: 
    panel_execute_cmd (WPanel * panel, long command) 
    36483648        move_down (panel); 
    36493649        break; 
    36503650    case CK_Left: 
    3651         stop_quickfilter(panel, FALSE); 
     3651        stop_quickfilter (panel, FALSE); 
    36523652        res = move_left (panel); 
    36533653        break; 
    36543654    case CK_Right: 
    3655         stop_quickfilter(panel, FALSE); 
     3655        stop_quickfilter (panel, FALSE); 
    36563656        res = move_right (panel); 
    36573657        break; 
    36583658    case CK_Bottom: 
    panel_execute_cmd (WPanel * panel, long command) 
    36633663        break; 
    36643664#ifdef HAVE_CHARSET 
    36653665    case CK_SelectCodepage: 
    3666         stop_quickfilter(panel, FALSE); 
     3666        stop_quickfilter (panel, FALSE); 
    36673667        panel_change_encoding (panel); 
    36683668        break; 
    36693669#endif 
    panel_execute_cmd (WPanel * panel, long command) 
    36743674        panel_content_scroll_right (panel); 
    36753675        break; 
    36763676    case CK_Search: 
    3677         stop_quickfilter(panel, FALSE); 
     3677        stop_quickfilter (panel, FALSE); 
    36783678        start_search (panel); 
    36793679        break; 
    36803680    case CK_SearchStop: 
    panel_key (WPanel * panel, int key) 
    37343734        return MSG_HANDLED; 
    37353735    } 
    37363736 
    3737     if(panel->quickfiltering && ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE)) 
     3737    if (panel->quickfiltering && ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE)) 
    37383738    { 
    3739         do_quickfilter(panel, key); 
     3739        do_quickfilter (panel, key); 
    37403740        return MSG_HANDLED; 
    37413741    } 
    37423742 
    panel_key (WPanel * panel, int key) 
    37523752 
    37533753    if (!command_prompt && ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE)) 
    37543754    { 
    3755         if(!panels_options.use_quickfilter) 
     3755        if (!panels_options.use_quickfilter) 
    37563756        { 
    37573757            start_search (panel); 
    37583758            do_search (panel, key); 
    37593759            return MSG_HANDLED; 
    37603760        } 
    3761         else if(panel->filter == NULL) 
     3761        else if (panel->filter == NULL) 
    37623762        { 
    3763             start_quickfilter(panel); 
    3764             do_quickfilter(panel, key); 
     3763            start_quickfilter (panel); 
     3764            do_quickfilter (panel, key); 
    37653765            return MSG_HANDLED; 
    37663766        } 
    37673767    } 
    do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact) 
    52115211/* --------------------------------------------------------------------------------------------- */ 
    52125212 
    52135213void 
    5214 stop_quickfilter(WPanel * panel, gboolean redraw) 
     5214stop_quickfilter (WPanel * panel, gboolean redraw) 
    52155215{ 
    52165216    if (!panel->quickfiltering) 
    52175217    { 
    stop_quickfilter(WPanel * panel, gboolean redraw) 
    52215221    panel->quickfilter_buffer[0] = '\0'; 
    52225222    g_free (panel->filter); 
    52235223    panel->filter = 0; 
    5224     if(redraw) 
     5224    if (redraw) 
    52255225        reread_cmd (); 
    52265226} 
    52275227 
  • src/filemanager/panel.h

    diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h
    index 4a294fe..ed8cbd1 100644
    a b void panel_init (void); 
    196196void panel_deinit (void); 
    197197gboolean do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); 
    198198 
    199 void stop_quickfilter(WPanel * panel, gboolean redraw); 
     199void stop_quickfilter (WPanel * panel, gboolean redraw); 
    200200 
    201201/* --------------------------------------------------------------------------------------------- */ 
    202202/*** inline functions ****************************************************************************/ 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index 4507ad3..fb734c6 100644
    a b typedef struct 
    6363    gboolean torben_fj_mode;    /* If TRUE, use some usability hacks by Torben */ 
    6464    panel_select_flags_t select_flags;  /* Select/unselect file flags */ 
    6565    gboolean use_quickfilter; 
    66     filter_mode_t filter_mode;        /* Quick search mode */ 
     66    filter_mode_t filter_mode;  /* Quick search mode */ 
    6767} panels_options_t; 
    6868 
    6969typedef struct macro_action_t 
  • src/filemanager/dir.c

    -- 
    2.9.0
    
    
    From 54bbe5320d22789f86863ebfbb2922e606277d2e Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Wed, 6 Jul 2016 21:12:47 +0200
    Subject: [PATCH 19/30] Remove or replace // comments
    
    ---
     src/filemanager/dir.c   | 3 +++
     src/filemanager/panel.c | 5 +----
     2 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
    index 9e60e44..a5ee95b 100644
    a b dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    685685        if ((list->len & 31) == 0) 
    686686            rotate_dash (TRUE); 
    687687    } 
     688 
     689    /* Always add ".." if list would be empty otherwise */ 
    688690    if (list->len == 0) 
    689691    { 
    690692        dir_list_init (list); 
    dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, 
    836838    tree_store_end_check (); 
    837839    g_hash_table_destroy (marked_files); 
    838840 
     841    /* Always add ".." if list would be empty otherwise */ 
    839842    if (list->len == 0) 
    840843    { 
    841844        file_entry_t *fentry; 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index c9716a7..872e2a4 100644
    a b apply_quickpanel_filter (WPanel * p) 
    27972797 
    27982798 
    27992799    l = strlen (p->quickfilter_buffer); 
    2800     fl = l + 2 + 1;             // + 2 for *<filter>*, 1 for trailing \0 
     2800    fl = l + 2 + 1; 
    28012801    new_filter = g_malloc (fl); 
    28022802 
    2803     //if malloc fails, applying the new filter also fails 
    28042803    if (new_filter == NULL) 
    28052804        return FALSE; 
    28062805 
    apply_quickpanel_filter (WPanel * p) 
    28092808    new_filter[fl - 2] = '*'; 
    28102809    new_filter[fl - 1] = '\0'; 
    28112810 
    2812     //First check if search would result in empty directory 
    28132811    search = mc_search_new (new_filter, NULL); 
    28142812    search->search_type = MC_SEARCH_T_GLOB; 
    28152813    search->is_entire_line = TRUE; 
    do_quickfilter (WPanel * panel, int key) 
    28682866    } 
    28692867    else 
    28702868    { 
    2871         //TODO: Check if key results in empty panel 
    28722869        panel->quickfilter_buffer[l] = (char) key; 
    28732870        panel->quickfilter_buffer[l + 1] = '\0'; 
    28742871    } 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 260092443dfcc98baf0aa4e8f07c503cab00b1b6 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 11:28:10 +0200
    Subject: [PATCH 20/30] Only stop quickfilter for left and right arrow when in
     lynx mode and we actually switched directories
    
    ---
     src/filemanager/panel.c | 16 ++++++++++------
     1 file changed, 10 insertions(+), 6 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 872e2a4..5fdea55 100644
    a b move_selection (WPanel * panel, int lines) 
    22052205static cb_ret_t 
    22062206move_left (WPanel * panel) 
    22072207{ 
     2208    cb_ret_t lynx_ret; 
    22082209    if (panel->list_cols > 1) 
    22092210    { 
    22102211        move_selection (panel, -panel_lines (panel)); 
    22112212        return MSG_HANDLED; 
    22122213    } 
    2213  
    2214     return maybe_cd (TRUE);     /* cd .. */ 
     2214    lynx_ret = maybe_cd (TRUE);     /* cd .. */ 
     2215    if(panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
     2216        stop_quickfilter(panel, TRUE); 
     2217    return lynx_ret; 
    22152218} 
    22162219 
    22172220/* --------------------------------------------------------------------------------------------- */ 
    move_left (WPanel * panel) 
    22192222static cb_ret_t 
    22202223move_right (WPanel * panel) 
    22212224{ 
     2225    cb_ret_t lynx_ret; 
    22222226    if (panel->list_cols > 1) 
    22232227    { 
    22242228        move_selection (panel, panel_lines (panel)); 
    22252229        return MSG_HANDLED; 
    22262230    } 
    2227  
    2228     return maybe_cd (FALSE);    /* cd (selection) */ 
     2231    lynx_ret = maybe_cd (FALSE);     /* cd .. */ 
     2232    if(panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
     2233        stop_quickfilter(panel, TRUE); 
     2234    return lynx_ret; 
    22292235} 
    22302236 
    22312237/* --------------------------------------------------------------------------------------------- */ 
    panel_execute_cmd (WPanel * panel, long command) 
    36453651        move_down (panel); 
    36463652        break; 
    36473653    case CK_Left: 
    3648         stop_quickfilter (panel, FALSE); 
    36493654        res = move_left (panel); 
    36503655        break; 
    36513656    case CK_Right: 
    3652         stop_quickfilter (panel, FALSE); 
    36533657        res = move_right (panel); 
    36543658        break; 
    36553659    case CK_Bottom: 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From d0322ebe994e2112ba98bced23c5515b099523f1 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 11:28:36 +0200
    Subject: [PATCH 21/30] Fix memory leak by freeing search in quickfilter
    
    ---
     src/filemanager/panel.c | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 5fdea55..1542142 100644
    a b apply_quickpanel_filter (WPanel * p) 
    28412841        } 
    28422842    } 
    28432843 
     2844    mc_search_free(search); 
    28442845    if (!is_found) 
    28452846    { 
    28462847        g_free (new_filter); 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 24dc60e2c10a0ab290acb4a31d27632f43596a62 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 11:30:54 +0200
    Subject: [PATCH 22/30] Apply indent
    
    ---
     src/filemanager/panel.c | 14 +++++++-------
     1 file changed, 7 insertions(+), 7 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 1542142..ff7646c 100644
    a b move_left (WPanel * panel) 
    22112211        move_selection (panel, -panel_lines (panel)); 
    22122212        return MSG_HANDLED; 
    22132213    } 
    2214     lynx_ret = maybe_cd (TRUE);     /* cd .. */ 
    2215     if(panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
    2216         stop_quickfilter(panel, TRUE); 
     2214    lynx_ret = maybe_cd (TRUE); /* cd .. */ 
     2215    if (panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
     2216        stop_quickfilter (panel, TRUE); 
    22172217    return lynx_ret; 
    22182218} 
    22192219 
    move_right (WPanel * panel) 
    22282228        move_selection (panel, panel_lines (panel)); 
    22292229        return MSG_HANDLED; 
    22302230    } 
    2231     lynx_ret = maybe_cd (FALSE);     /* cd .. */ 
    2232     if(panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
    2233         stop_quickfilter(panel, TRUE); 
     2231    lynx_ret = maybe_cd (FALSE);        /* cd .. */ 
     2232    if (panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
     2233        stop_quickfilter (panel, TRUE); 
    22342234    return lynx_ret; 
    22352235} 
    22362236 
    apply_quickpanel_filter (WPanel * p) 
    28412841        } 
    28422842    } 
    28432843 
    2844     mc_search_free(search); 
     2844    mc_search_free (search); 
    28452845    if (!is_found) 
    28462846    { 
    28472847        g_free (new_filter); 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 7a57074adb03b6f7bbbf7b28dbd6e1ca91cf93c0 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 12:18:32 +0200
    Subject: [PATCH 23/30] Remove stop_quickfilter commands from panel_execute_cmd
     and move it to the lowest possible cd method to catch all cases
    
    ---
     src/filemanager/panel.c | 22 ++++------------------
     1 file changed, 4 insertions(+), 18 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index ff7646c..82d6328 100644
    a b move_selection (WPanel * panel, int lines) 
    22052205static cb_ret_t 
    22062206move_left (WPanel * panel) 
    22072207{ 
    2208     cb_ret_t lynx_ret; 
    22092208    if (panel->list_cols > 1) 
    22102209    { 
    22112210        move_selection (panel, -panel_lines (panel)); 
    22122211        return MSG_HANDLED; 
    22132212    } 
    2214     lynx_ret = maybe_cd (TRUE); /* cd .. */ 
    2215     if (panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
    2216         stop_quickfilter (panel, TRUE); 
    2217     return lynx_ret; 
     2213    return maybe_cd (TRUE);        /* cd .. */ 
    22182214} 
    22192215 
    22202216/* --------------------------------------------------------------------------------------------- */ 
    move_left (WPanel * panel) 
    22222218static cb_ret_t 
    22232219move_right (WPanel * panel) 
    22242220{ 
    2225     cb_ret_t lynx_ret; 
    22262221    if (panel->list_cols > 1) 
    22272222    { 
    22282223        move_selection (panel, panel_lines (panel)); 
    22292224        return MSG_HANDLED; 
    22302225    } 
    2231     lynx_ret = maybe_cd (FALSE);        /* cd .. */ 
    2232     if (panels_options.navigate_with_arrows && lynx_ret == MSG_HANDLED) 
    2233         stop_quickfilter (panel, TRUE); 
    2234     return lynx_ret; 
     2226    return maybe_cd (FALSE);        /* cd .. */ 
    22352227} 
    22362228 
    22372229/* --------------------------------------------------------------------------------------------- */ 
    _do_panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_ 
    34113403    /* Reload current panel */ 
    34123404    panel_clean_dir (panel); 
    34133405 
     3406    stop_quickfilter (panel, FALSE); 
     3407 
    34143408    dir_list_load (&panel->dir, panel->cwd_vpath, panel->sort_field->sort_routine, 
    34153409                   &panel->sort_info, panel->filter); 
    34163410    try_to_select (panel, get_parent_dir_name (panel->cwd_vpath, olddir_vpath)); 
    panel_execute_cmd (WPanel * panel, long command) 
    35563550    switch (command) 
    35573551    { 
    35583552    case CK_PanelOtherCd: 
    3559         stop_quickfilter (panel, FALSE); 
    35603553        chdir_other_panel (panel); 
    35613554        break; 
    35623555    case CK_PanelOtherCdLink: 
    3563         stop_quickfilter (panel, FALSE); 
    35643556        chdir_to_readlink (panel); 
    35653557        break; 
    35663558    case CK_CopySingle: 
    panel_execute_cmd (WPanel * panel, long command) 
    35703562        delete_cmd_local (); 
    35713563        break; 
    35723564    case CK_Enter: 
    3573         stop_quickfilter (panel, FALSE); 
    35743565        do_enter (panel); 
    35753566        break; 
    35763567    case CK_ViewRaw: 
    panel_execute_cmd (WPanel * panel, long command) 
    36013592        prev_page (panel); 
    36023593        break; 
    36033594    case CK_CdChild: 
    3604         stop_quickfilter (panel, FALSE); 
    36053595        goto_child_dir (panel); 
    36063596        break; 
    36073597    case CK_CdParent: 
    3608         stop_quickfilter (panel, FALSE); 
    36093598        goto_parent_dir (panel); 
    36103599        break; 
    36113600    case CK_History: 
    panel_execute_cmd (WPanel * panel, long command) 
    36423631        mark_file_right (panel); 
    36433632        break; 
    36443633    case CK_CdParentSmart: 
    3645         stop_quickfilter (panel, FALSE); 
    36463634        res = force_maybe_cd (); 
    36473635        break; 
    36483636    case CK_Up: 
    panel_execute_cmd (WPanel * panel, long command) 
    36653653        break; 
    36663654#ifdef HAVE_CHARSET 
    36673655    case CK_SelectCodepage: 
    3668         stop_quickfilter (panel, FALSE); 
    36693656        panel_change_encoding (panel); 
    36703657        break; 
    36713658#endif 
    panel_execute_cmd (WPanel * panel, long command) 
    36763663        panel_content_scroll_right (panel); 
    36773664        break; 
    36783665    case CK_Search: 
    3679         stop_quickfilter (panel, FALSE); 
    36803666        start_search (panel); 
    36813667        break; 
    36823668    case CK_SearchStop: 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 2778974289596de134e8b6f864e2014229f371e9 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 12:20:23 +0200
    Subject: [PATCH 24/30] Apply indent guidelines
    
    ---
     src/filemanager/panel.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 82d6328..bfe620a 100644
    a b move_left (WPanel * panel) 
    22102210        move_selection (panel, -panel_lines (panel)); 
    22112211        return MSG_HANDLED; 
    22122212    } 
    2213     return maybe_cd (TRUE);        /* cd .. */ 
     2213    return maybe_cd (TRUE);     /* cd .. */ 
    22142214} 
    22152215 
    22162216/* --------------------------------------------------------------------------------------------- */ 
    move_right (WPanel * panel) 
    22232223        move_selection (panel, panel_lines (panel)); 
    22242224        return MSG_HANDLED; 
    22252225    } 
    2226     return maybe_cd (FALSE);        /* cd .. */ 
     2226    return maybe_cd (FALSE);    /* cd .. */ 
    22272227} 
    22282228 
    22292229/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 53f8b78d0e1d7f39fb42a3558e41054811783e35 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 12:28:22 +0200
    Subject: [PATCH 25/30] Replae reread_cmd by update_panels calls to improve
     quickfilter performance
    
    ---
     src/filemanager/panel.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index bfe620a..c091ac2 100644
    a b apply_quickpanel_filter (WPanel * p) 
    28432843    g_free (p->filter); 
    28442844    p->filter = new_filter; 
    28452845 
    2846     reread_cmd (); 
     2846    update_panels (UP_OPTIMIZE, UP_KEEPSEL); 
    28472847    return TRUE; 
    28482848} 
    28492849 
    stop_quickfilter (WPanel * panel, gboolean redraw) 
    52105210    g_free (panel->filter); 
    52115211    panel->filter = 0; 
    52125212    if (redraw) 
    5213         reread_cmd (); 
     5213        update_panels (UP_OPTIMIZE, UP_KEEPSEL); 
    52145214} 
    52155215 
    52165216/* --------------------------------------------------------------------------------------------- */ 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 488790b803b865edeb090330237663e613ff5129 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 12:44:56 +0200
    Subject: [PATCH 26/30] Let abort also stop quickfiltering
    
    ---
     src/filemanager/panel.c | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index be125bc..b48ef2c 100644
    a b panel_key (WPanel * panel, int key) 
    37133713    if (is_abort_char (key)) 
    37143714    { 
    37153715        stop_search (panel); 
     3716        stop_quickfilter (panel, TRUE); 
    37163717        return MSG_HANDLED; 
    37173718    } 
    37183719 
  • src/filemanager/midnight.c

    -- 
    2.9.0
    
    
    From ea9c85ad4bcd0d656ff4f82b263dd17f6c4a83bf Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 14:46:18 +0200
    Subject: [PATCH 27/30] Allow *,-,+ and \ as input for quickfiltering
    
    ---
     src/filemanager/midnight.c |  2 +-
     src/filemanager/panel.c    | 23 ++++++++++++++++++-----
     2 files changed, 19 insertions(+), 6 deletions(-)
    
    diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c
    index 68d12da..aa93309 100644
    a b midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void 
    14931493 
    14941494        if ((!mc_global.tty.alternate_plus_minus 
    14951495             || !(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) && !quote 
    1496             && !current_panel->searching) 
     1496            && !current_panel->searching && !current_panel->quickfiltering) 
    14971497        { 
    14981498            if (!only_leading_plus_minus) 
    14991499            { 
  • src/filemanager/panel.c

    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index b48ef2c..c99a90e 100644
    a b stop_search (WPanel * panel) 
    27872787static gboolean 
    27882788apply_quickpanel_filter (WPanel * p) 
    27892789{ 
    2790     size_t l, fl; 
     2790    size_t l, fl, cp_index; 
    27912791    int i; 
    27922792    char *new_filter; 
    27932793    mc_search_t *search; 
    27942794    gboolean is_found; 
    27952795 
     2796    if(p->quickfilter_buffer == NULL) 
     2797        return FALSE; 
    27962798 
    27972799    l = strlen (p->quickfilter_buffer); 
     2800    if(l == 0) 
     2801        return FALSE; 
     2802 
    27982803    fl = l + 2 + 1; 
    27992804    new_filter = g_malloc (fl); 
    28002805 
    28012806    if (new_filter == NULL) 
    28022807        return FALSE; 
    28032808 
    2804     new_filter[0] = '*'; 
    2805     memcpy (new_filter + 1, p->quickfilter_buffer, l); 
    2806     new_filter[fl - 2] = '*'; 
    2807     new_filter[fl - 1] = '\0'; 
     2809    /* Copy string. Prefix/Suffix it with '*' to have the word as infix */ 
     2810    cp_index = 0; 
     2811    if(p->quickfilter_buffer[cp_index] != '*') 
     2812        new_filter[cp_index++] = '*'; 
     2813 
     2814    memcpy (new_filter + cp_index, p->quickfilter_buffer, l); 
     2815    cp_index += l; 
     2816 
     2817    if(p->quickfilter_buffer[l - 1] != '*') 
     2818        new_filter[cp_index++] = '*'; 
     2819 
     2820    new_filter[cp_index] = '\0'; 
    28082821 
    28092822    search = mc_search_new (new_filter, NULL); 
    28102823    search->search_type = MC_SEARCH_T_GLOB; 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 5e385d1109467d7505b3fc1253980243e3e9b3e9 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 16:05:21 +0200
    Subject: [PATCH 28/30] Apply code guidelines. Remove tautological comparison
    
    ---
     src/filemanager/panel.c | 9 +++------
     1 file changed, 3 insertions(+), 6 deletions(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index c99a90e..655df34 100644
    a b apply_quickpanel_filter (WPanel * p) 
    27932793    mc_search_t *search; 
    27942794    gboolean is_found; 
    27952795 
    2796     if(p->quickfilter_buffer == NULL) 
    2797         return FALSE; 
    2798  
    27992796    l = strlen (p->quickfilter_buffer); 
    2800     if(l == 0) 
     2797    if (l == 0) 
    28012798        return FALSE; 
    28022799 
    28032800    fl = l + 2 + 1; 
    apply_quickpanel_filter (WPanel * p) 
    28082805 
    28092806    /* Copy string. Prefix/Suffix it with '*' to have the word as infix */ 
    28102807    cp_index = 0; 
    2811     if(p->quickfilter_buffer[cp_index] != '*') 
     2808    if (p->quickfilter_buffer[cp_index] != '*') 
    28122809        new_filter[cp_index++] = '*'; 
    28132810 
    28142811    memcpy (new_filter + cp_index, p->quickfilter_buffer, l); 
    28152812    cp_index += l; 
    28162813 
    2817     if(p->quickfilter_buffer[l - 1] != '*') 
     2814    if (p->quickfilter_buffer[l - 1] != '*') 
    28182815        new_filter[cp_index++] = '*'; 
    28192816 
    28202817    new_filter[cp_index] = '\0'; 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From f108a28981881cc1e5b84265f03bc5c4f24e5823 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 17:38:18 +0200
    Subject: [PATCH 29/30] Add a mini_info for quickfiltering to see the actual
     filter string
    
    ---
     src/filemanager/panel.c | 8 ++++++++
     1 file changed, 8 insertions(+)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 655df34..71951bc 100644
    a b display_mini_info (WPanel * panel) 
    998998        return; 
    999999    } 
    10001000 
     1001    if (panel->quickfiltering) 
     1002    { 
     1003        tty_setcolor (INPUT_COLOR); 
     1004        tty_print_string ("Filter: "); 
     1005        tty_print_string (str_fit_to_term (panel->quickfilter_buffer, w->cols - 3, J_LEFT)); 
     1006        return; 
     1007    } 
     1008 
    10011009    /* Status resolves links and show them */ 
    10021010    set_colors (panel); 
    10031011 
  • src/filemanager/panel.c

    -- 
    2.9.0
    
    
    From 8f999e7b97882fff568912f31fd259d22d9e5a07 Mon Sep 17 00:00:00 2001
    From: czyba <czyba@embedded.rwth-aachen.de>
    Date: Sun, 10 Jul 2016 18:15:36 +0200
    Subject: [PATCH 30/30] Check remaining length when setting minipage
    
    ---
     src/filemanager/panel.c | 7 ++++++-
     1 file changed, 6 insertions(+), 1 deletion(-)
    
    diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
    index 71951bc..f6a66d6 100644
    a b display_mini_info (WPanel * panel) 
    10011001    if (panel->quickfiltering) 
    10021002    { 
    10031003        tty_setcolor (INPUT_COLOR); 
     1004        if (w->cols - 1 < 10) 
     1005        { 
     1006            tty_print_string (str_fit_to_term ("Filter: ", w->cols - 2, J_LEFT)); 
     1007            return; 
     1008        } 
    10041009        tty_print_string ("Filter: "); 
    1005         tty_print_string (str_fit_to_term (panel->quickfilter_buffer, w->cols - 3, J_LEFT)); 
     1010        tty_print_string (str_fit_to_term (panel->quickfilter_buffer, w->cols - 10, J_LEFT)); 
    10061011        return; 
    10071012    } 
    10081013