Skip to content

Commit 20f0911

Browse files
committed
(put_tagged): refactroing.
Constify argument. Fix coding style. Minor optimization: break the loop when all tagged files are put to command line. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
1 parent a47954a commit 20f0911

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/filemanager/filemanager.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ put_current_selected (void)
773773
/* --------------------------------------------------------------------------------------------- */
774774

775775
static void
776-
put_tagged (WPanel *panel)
776+
put_tagged (const WPanel *panel)
777777
{
778778
if (!command_prompt)
779779
return;
@@ -782,20 +782,18 @@ put_tagged (WPanel *panel)
782782

783783
if (panel->marked == 0)
784784
{
785-
const file_entry_t *fe;
785+
const file_entry_t *fe = panel_current_entry (panel);
786786

787-
fe = panel_current_entry (panel);
788787
if (fe != NULL)
789788
command_insert (cmdline, fe->fname->str, TRUE);
790789
}
791790
else
792-
{
793-
int i;
794-
795-
for (i = 0; i < panel->dir.len; i++)
791+
for (int m = 0, i = 0; m < panel->marked && i < panel->dir.len; i++)
796792
if (panel->dir.list[i].f.marked != 0)
793+
{
797794
command_insert (cmdline, panel->dir.list[i].fname->str, TRUE);
798-
}
795+
m++;
796+
}
799797

800798
input_enable_update (cmdline);
801799
}

0 commit comments

Comments
 (0)