Ticket #1581 (accepted enhancement)

Opened 14 years ago

Last modified 3 years ago

Tabs or tab equivalent proposed

Reported by: iNode Owned by: slavazanko
Priority: major Milestone: Future Releases
Component: mc-core Version: master
Keywords: Cc: cosminadrianpopescu@…, egmont@…
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description (last modified by iNode) (diff)

Many users has expirience with tabbed applications like firefox and support for tabs in mc can be usefull.

Please describe your opinion about topic.

What use case you see for tabs? How it should looks like? Should it be clickable tabs like firefox/vim, or buffers like emacs/far manager?

andre> i don't know emacs/far manager - but i like the tabs in vim, however - buffers in vim are awesom, too


mc-tabs.patch (60.8 KB) - added by cosminadrianpopescu 9 years ago.
Tabs patch

Change History

comment:1 Changed 14 years ago by iNode

  • Description modified (diff)

comment:2 Changed 14 years ago by andrew_b

I think it's a duplicate of #1490.

comment:3 Changed 14 years ago by iNode

No, #1490 about multiple viewer and editor sessions not about tabs in panels for navigation, but, yes, it's related ticket.

comment:4 Changed 13 years ago by AMIGrAve

Yeah ! tabs is really the feature I miss in midnight commander.

If screen estate is the stopper for this feature, a filemaster like buffer switcher could come to the rescue :

See "< 0 >" & "< 1 >" widgets on this screenshot :


comment:5 Changed 9 years ago by cosminadrianpopescu

  • Cc cosminadrianpopescu@… added
  • Branch state set to no branch

Changed 9 years ago by cosminadrianpopescu

Tabs patch

comment:6 Changed 9 years ago by cosminadrianpopescu

Patch implementing:

Panels Menu:

  • Create tab (creates a new tab)
  • Close tab (closes an existing tab, if the tab is not the only one)
  • Rename tab (changes the title of the current tab)
  • Next tab (changes the current tab)
  • Previous tab (changes the current tab)
  • Go to tab (displays a list of tabs from which the user can select one to switch to)
  • Move tab right (moves a tab to its right)
  • Move tab left (moves a tab to its left)


  • Tabs options (the tabs options)
  • Save tabs sessions (the current opened tabs can be saved into sessions that can be later restored).
  • Restore tabs session (restores a session of tabs saved previously)


  • Move tab to the other panel (move the current tab from the current panel to the other panel)
  • Copy tab to the other panel (copy the current tab from the current panel to the other panel)
  • Swap tabs (swaps the current tab from the current panel with the current tab from the other panel)

Tabs options:

  • Where to open a new tab (specify where you want a new tab to be opened)
  • Where to display the tab bar (bottom or top of the panel)
  • If only one tab, then don't display the tab bar anymore.
  • Restore the last session when starting mc
  • Highlight the current tab in the other panel. If this is checked, in the other panel, the current tab will be marked with an "*"

Please note that if the last session is restored, the current opened folder in the current panel will not be the folder from which mc is launched, but the folder that was last current when mc was closed.

From a technical point of view, the tabs are a simple list of structures containing a name (which can be NULL in which case the name of the current tab is the name of the current folder) and a path (a vfs_path_t structure) containing the current path of the tab. Whenever a tab is created, a new tab structure is added in the list. When a tab is changing the mc will do a simple cd by calling the do_cd function. I think that the implementation is pretty much straight forward.

The only thing a little bit complex might be the display_info function. That function will determine if all the tabs can be displayed, if not will calculate which can be displayed starting from the current tab to the left and then to the right if there is still space.

All my code is added between #ifdef WITH_TABS and #endif directives. The WITH_TABS can be set at configure time. By default the tabs will not be compiled in, but can be be compiles using ./configure --with-tabs.

Compiled against mc-4.8.13 on the following platforms:

  • Arch Linux
  • Red Hat 5
  • Ubuntu
  • Cygwin (win 7)

comment:7 Changed 9 years ago by egmont

  • Cc egmont@… added

comment:8 Changed 9 years ago by slavazanko

  • Status changed from new to accepted
  • Owner set to slavazanko

comment:9 Changed 9 years ago by angel_il

CC panel.lo

panel.c: In function '_restore_tabs':
panel.c:5452:12: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]

fscanf (f, "%d\n%d\n", &result.idx, &crt_idx);

panel.c: In function 'read_line':
panel.c:5524:11: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]

fgets (line, max, f);

comment:10 Changed 9 years ago by angel_il

so... i have troube with select needed "Tab"
how to reprduce:
1) create a few Tabs
like this:
║ mc │ all │ aspell- ║
mc - tab1
all - tab2
aspell- - tab3

2) select tab2
3) try select tab1...
after mouse click to the char "m" in name | mc | tab1 is selected
after mouse click to the char "c" in name | mc | tab2 is selected (but should be selected tab1)

comment:11 Changed 8 years ago by russurquhart1

Can this patch be added and used with more current versions of mc? I am currently running .15. Any suggestions on compiling this in and using it? Any gotchas? Thanks

comment:12 Changed 8 years ago by mooffie

@Cosmin: Hats off for your effort. You code looks very nice!

FWIW, mc^2 now has a tabs module (screenshot). I started it earlier today as a proof-of-concept, but it's fully featured and functional.

It behaves differently than Cosmin's tabs. E.g., its tabs hold both panels, not just one side. Some will like this, some won't. And all the panels' properties are recorded (marked files, sort, panelization, etc.), not just the directory.

(You don't need to configure anything to try it out. On startup you'll be asked which features you want to enable.)

Last edited 8 years ago by mooffie (previous) (diff)

comment:13 Changed 8 years ago by cosminadrianpopescu

Unfortunately, meanwhile, I've discovered vifm and switched to it. So, I am not using anymore midnight commander. Not to say that MC isn't a great product. I've been using it for years. For me it just comes more naturally to use something with the VIM paradigm.

But, since I won't be using it anymore, I will not continue developing the tabs anymore.

comment:14 Changed 3 years ago by sven.luebke


In case someone is still interested in this implementation of tabs (at least I am ;-) ), please have a look at:


I integrated and adapted the changes by cosminadrianpopescu into the master of a fork of Midnight commander. Most of the things are working, though there are still some minor isuues. Thanks again to cosminadrianpopescu!

Best regards,

Last edited 3 years ago by sven.luebke (previous) (diff)
Note: See TracTickets for help on using tickets.