Select/Unselect Files cannot mark directories only
- From: "Mike Smithson" <mdooligan gmail com>
- To: mc gnome org
- Subject: Select/Unselect Files cannot mark directories only
- Date: Tue, 26 Aug 2014 13:04:53 -0700
I can no longer select *only* directories in the Select File dialog.
I used to be able to do it by typing / before the pattern. Now that
does nothing.
In cmd.c:select_unselect_cmd():260 we have the line:
[code]
if (S_ISDIR (current_panel->dir.list[i].st.st_mode) && files_only
!= 0)
continue;
[/code]
But there is no way, as far as I can see, to select dirs only.
In mc-4.6.2 we had this:
[code]
/* Check if they specified a directory */
if (*reg_exp_t == PATH_SEP) {
dirflag = 1;
reg_exp_t++;
}
[/code]
Any notion why this got dropped?
BTW the hack seems quite trivial, something like this:
[code]
--- src/filemanager/cmd.c~ 2014-04-01 03:54:01.000000000 -0700
+++ src/filemanager/cmd.c 2014-08-26 10:47:50.319707218 -0700
@@ -215,9 +215,10 @@ select_unselect_cmd (const char *title,
int case_sens = (select_flags & SELECT_MATCH_CASE) != 0;
int shell_patterns = (select_flags & SELECT_SHELL_PATTERNS) != 0;
- char *reg_exp;
+ char *reg_exp, *p;
mc_search_t *search;
int i;
+ int dirflag = 0;
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
@@ -246,6 +247,10 @@ select_unselect_cmd (const char *title,
{
g_free (reg_exp);
return;
+ } else if ( *reg_exp == PATH_SEP ) {
+ dirflag = 1;
+ p = reg_exp;
+ memmove ( p, p+1, strlen (p) );
}
search = mc_search_new (reg_exp, -1, NULL);
@@ -257,8 +262,11 @@ select_unselect_cmd (const char *title,
{
if (DIR_IS_DOTDOT (current_panel->dir.list[i].fname))
continue;
- if (S_ISDIR (current_panel->dir.list[i].st.st_mode) && files_only
!= 0)
- continue;
+ if (S_ISDIR (current_panel->dir.list[i].st.st_mode) ) {
+ if ( files_only != 0 && ! dirflag )
+ continue;
+ } else if ( dirflag )
+ continue;
if (mc_search_run (search, current_panel->dir.list[i].fname,
0, current_panel->dir.list[i].fnamelen, NULL))
[/code]
--
Peace and Cheer
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]