Skip to content

Focus the command input by default in "external panelize" dialog #4705

@vpatkov

Description

@vpatkov

Is there an existing request for this?

  • I have searched the existing issues

Is your feature request related to a problem?

I always use "External panelize" command to find files with external commands like fd and rg -l because I found it's much faster and convenient than using the builtin mc "Find file" command. Unfortunately, it requires extra tab key to focus the command input, because the listbox of predefined commands is focused by default.

What do you think about making the command input focused by default, and maybe placing it on top, so tab will focus the listbox. I didn't make a PR, because I'm not sure how other people uses the dialog usually.

Describe the solution you'd like

diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c
index 21afcc0db..616b1452b 100644
--- a/src/filemanager/panelize.c
+++ b/src/filemanager/panelize.c
@@ -203,6 +203,13 @@ external_panelize_init (void)
 
     // add listbox to the dialogs
     y = UY;
+    group_add_widget (g, label_new (y++, UX, _ ("Command")));
+    pname = input_new (y++, UX, input_colors, panelize_cols - UX * 2, "", "in",
+                       INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_COMMANDS
+                           | INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES | INPUT_COMPLETE_CD
+                           | INPUT_COMPLETE_SHELL_ESC);
+    group_add_widget (g, pname);
+
     group_add_widget (g, groupbox_new (y++, UX, 12, panelize_cols - UX * 2, ""));
 
     l_panelize = listbox_new (y, UX + 1, 10, panelize_cols - UX * 2 - 2, FALSE, NULL);
@@ -211,13 +218,6 @@ external_panelize_init (void)
     group_add_widget (g, l_panelize);
 
     y += WIDGET (l_panelize)->rect.lines + 1;
-    group_add_widget (g, label_new (y++, UX, _ ("Command")));
-    pname = input_new (y++, UX, input_colors, panelize_cols - UX * 2, "", "in",
-                       INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_COMMANDS
-                           | INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES | INPUT_COMPLETE_CD
-                           | INPUT_COMPLETE_SHELL_ESC);
-    group_add_widget (g, pname);
-
     group_add_widget (g, hline_new (y++, -1, -1));
 
     x = (panelize_cols - blen) / 2;
@@ -232,7 +232,7 @@ external_panelize_init (void)
         x += button_get_len (b) + 1;
     }
 
-    widget_select (WIDGET (l_panelize));
+    widget_select (WIDGET (pname));
 }
 
 /* --------------------------------------------------------------------------------------------- */

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageNeeds triage by maintainersprio: mediumHas the potential to affect progress

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions