[FarGroup/FarManager] master: gh-1042: Show file name in local user menu title (658636f05)

1 view
Skip to first unread message

farg...@farmanager.com

unread,
Nov 8, 2025, 2:31:00 PM (8 days ago) Nov 8
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/658636f05fe126433516a72fc47f7e788bf3c475

>---------------------------------------------------------------

commit 658636f05fe126433516a72fc47f7e788bf3c475
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Sat Nov 8 19:28:20 2025 +0000

gh-1042: Show file name in local user menu title


>---------------------------------------------------------------

658636f05fe126433516a72fc47f7e788bf3c475
far/changelog | 5 +++++
far/usermenu.cpp | 34 +++++++++++++++++++++++-----------
far/vbuild.m4 | 2 +-
3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/far/changelog b/far/changelog
index c9be99ba5..75370b10e 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,8 @@
+--------------------------------------------------------------------------------
+drkns 2025-11-08 19:25:50+00:00 - build 6589
+
+1. gh-1042: Show file name in local user menu title.
+
--------------------------------------------------------------------------------
yulian5 2025-11-07 23:50:00-00:00 - build 6588

diff --git a/far/usermenu.cpp b/far/usermenu.cpp
index 78442e623..6b7595b70 100644
--- a/far/usermenu.cpp
+++ b/far/usermenu.cpp
@@ -117,9 +117,10 @@ private:

enum class menu_mode
{
- local,
- user,
- global,
+ local, // .\FarMenu.ini
+ user, // %FARPROFILE%\FarMenu.ini
+ global, // %FARHOME%\FarMenu.ini
+ custom, // arbitrary file
};

menu_mode m_MenuMode{ menu_mode::local };
@@ -386,6 +387,8 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
}
else
{
+ m_MenuMode = menu_mode::custom;
+
auto ParentDir = MenuFileName;
CutToParent(ParentDir);
strMenuFilePath = ParentDir;
@@ -418,7 +421,7 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
LOGERROR(L"{}"sv, e);
}
}
- else if (m_MenuMode != menu_mode::user)
+ else if (m_MenuMode != menu_mode::user && m_MenuMode != menu_mode::custom)
{
// Файл не открылся. Смотрим дальше.
if (m_MenuMode == menu_mode::global) // был в %FARHOME%?
@@ -457,6 +460,10 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
case menu_mode::user:
MenuTitle = concat(msg(lng::MMainMenuTitle), L" ("sv, msg(m_MenuMode == menu_mode::global? lng::MMainMenuGlobal : lng::MMainMenuUser), L')');
break;
+
+ case menu_mode::custom:
+ MenuTitle = PointToName(MenuFileName);
+ break;
}

// вызываем меню
@@ -471,11 +478,14 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
// Показать меню родительского каталога
case EC_PARENT_MENU:
{
- if (m_MenuMode == menu_mode::local)
+ if (m_MenuMode == menu_mode::local || m_MenuMode == menu_mode::custom)
{
- // Menu can be invoked from any file with any name
- // Going up switches to standard names & logic
- MenuFileName = {};
+ if (m_MenuMode == menu_mode::custom)
+ {
+ // Menu can be invoked from any file with any name
+ // Going up switches to standard names & logic
+ MenuFileName = {};
+ }

if (CutToParent(strMenuFilePath))
{
@@ -499,11 +509,12 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
// $ 14.07.2000 VVM: Shift+F2 переключает Главное меню/локальное в цикле
switch (m_MenuMode)
{
- case menu_mode::local:
+ case menu_mode::custom:
// Menu can be invoked from any file with any name
// Switching to global switches to standard names & logic
MenuFileName = {};
-
+ [[fallthrough]];
+ case menu_mode::local:
m_MenuMode = menu_mode::global;
strMenuFilePath = Global->Opt->GlobalUserMenuDir;
break;
@@ -516,6 +527,7 @@ void UserMenu::ProcessUserMenu(bool ChooseMenuType, string_view MenuFileName)
case menu_mode::user:
strMenuFilePath = Global->CtrlObject->CmdLine()->GetCurDir();
m_MenuMode = menu_mode::local;
+ break;
}

break;
@@ -758,7 +770,7 @@ int UserMenu::ProcessSingleMenu(std::list<UserMenuItem>& Menu, int MenuPos, std:
return 1;

case KEY_BS: // Показать меню из родительского каталога только в MM_LOCAL режиме
- if (m_MenuMode == menu_mode::local)
+ if (m_MenuMode == menu_mode::local || m_MenuMode == menu_mode::custom)
{
ReturnCode=EC_PARENT_MENU;
UserMenu->Close(-1);
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index e6dbf1cf1..9af4a6111 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6588
+6589


Reply all
Reply to author
Forward
0 new messages