Repository :
https://github.com/FarGroup/FarManager
On branch : master
Link :
https://github.com/FarGroup/FarManager/commit/940da91e8648f9b811b6236d4f80c93442abb744
>---------------------------------------------------------------
commit 940da91e8648f9b811b6236d4f80c93442abb744
Author: Alex Alabuzhev <
alab...@gmail.com>
Date: Fri Jan 30 20:01:37 2026 +0000
Continue 6638
>---------------------------------------------------------------
940da91e8648f9b811b6236d4f80c93442abb744
far/changelog | 5 +++++
far/vbuild.m4 | 2 +-
far/vmenu.cpp | 53 +++++++++++++++++++++++------------------------------
3 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/far/changelog b/far/changelog
index bcf8bb1a5..687a7a42f 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,8 @@
+--------------------------------------------------------------------------------
+drkns 2026-01-30 20:00:26+00:00 - build 6639
+
+1. Continue 6638.
+
--------------------------------------------------------------------------------
drkns 2026-01-28 22:43:59+00:00 - build 6638
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index 2047e9c6c..257506515 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6638
+6639
diff --git a/far/vmenu.cpp b/far/vmenu.cpp
index b8cf186e7..55ca9f25b 100644
--- a/far/vmenu.cpp
+++ b/far/vmenu.cpp
@@ -2702,50 +2702,43 @@ void VMenu::DrawTitles() const
{
if (CheckFlags(VMENU_SHOWNOBOX)) return;
- const auto MaxTitleLength = m_Where.width() - 3;
+ const auto MaxTitleLength = m_Where.width() - 4;
- if (!strTitle.empty() || bFilterEnabled)
+ const auto draw_title = [&](string_view const Str, int const YPos)
{
- string strDisplayTitle;
- string_view DisplayTitle;
-
- if (bFilterEnabled)
- {
- strDisplayTitle = bFilterLocked?
- far::format(L"{}{}<{}>"sv, strTitle, strTitle.empty()? L""sv : L" "sv, strFilter) :
- far::format(L"[{}]"sv, strFilter);
-
- DisplayTitle = strDisplayTitle;
- }
- else
- DisplayTitle = strTitle;
-
- auto WidthTitle = static_cast<int>(visual_string_length(DisplayTitle));
+ auto WidthTitle = static_cast<int>(visual_string_length(Str));
if (WidthTitle > MaxTitleLength)
- WidthTitle = MaxTitleLength - 1;
+ WidthTitle = MaxTitleLength;
- GotoXY(m_Where.left + (m_Where.width() - 2 - WidthTitle) / 2, m_Where.top);
+ GotoXY(m_Where.left + (m_Where.width() - 2 - WidthTitle) / 2, YPos);
set_color(Colors, color_indices::Title);
Text(L' ');
- Text(DisplayTitle, MaxTitleLength - 1);
+ Text(Str, MaxTitleLength);
Text(L' ');
- }
+ };
- if (!strBottomTitle.empty())
+ if (bFilterEnabled)
{
- auto WidthTitle = static_cast<int>(visual_string_length(strBottomTitle));
+ const auto MaxFilterLength = MaxTitleLength - 2uz; // 2 for filter brackets
+ const auto TruncatedFilter = truncate_left(strFilter, MaxFilterLength);
+ const auto TruncatedFilterLength = static_cast<int>(visual_string_length(TruncatedFilter));
+ const auto TruncatedTitle = truncate_right(strTitle, std::max(0, MaxTitleLength - 1 - 2 - TruncatedFilterLength)); // 1 for space between title and filter, 2 for filter brackets
- if (WidthTitle > MaxTitleLength)
- WidthTitle = MaxTitleLength - 1;
+ const auto Brackets = bFilterLocked? L"<>"sv : L"[]"sv;
+ const auto DisplayTitle = concat(TruncatedTitle, TruncatedTitle.empty()? L""sv : L" "sv, Brackets[0], TruncatedFilter, Brackets[1]);
- GotoXY(m_Where.left + (m_Where.width() - 2 - WidthTitle) / 2, m_Where.bottom);
- set_color(Colors, color_indices::Title);
+ draw_title(DisplayTitle, m_Where.top);
+ }
+ else if (!strTitle.empty())
+ {
+ draw_title(strTitle, m_Where.top);
+ }
- Text(L' ');
- Text(strBottomTitle, MaxTitleLength - 1);
- Text(L' ');
+ if (!strBottomTitle.empty())
+ {
+ draw_title(strBottomTitle, m_Where.bottom);
}
if constexpr ((false))