Repository :
https://github.com/FarGroup/FarManager
On branch : master
Link :
https://github.com/FarGroup/FarManager/commit/003c2c46c6c46c9605fddbf6c73a88eb4577adeb
>---------------------------------------------------------------
commit 003c2c46c6c46c9605fddbf6c73a88eb4577adeb
Author: Michael Z. Kadaner <
MKad...@users.noreply.github.com>
Date: Sun Mar 1 14:49:00 2026 -0500
Fixed drawing empty menu items.
Reported on bugtracker. Fallout of 6651.
>---------------------------------------------------------------
003c2c46c6c46c9605fddbf6c73a88eb4577adeb
far/changelog | 6 ++++++
far/vbuild.m4 | 2 +-
far/vmenu.cpp | 57 ++++++++++++++++++++++++++++++---------------------------
3 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/far/changelog b/far/changelog
index 6374a6a10..abc8a8939 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,9 @@
+--------------------------------------------------------------------------------
+MZK 2026-03-01 14:50:19-05:00 - build 6652
+
+1. Fixed drawing empty manu items.
+ Reported on bugtracker. Fallout of 6651.
+
--------------------------------------------------------------------------------
MZK 2026-02-28 10:54:01-05:00 - build 6651
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index d8b19232c..4b3a36f74 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6651
+6652
diff --git a/far/vmenu.cpp b/far/vmenu.cpp
index 15910e343..6182ea95f 100644
--- a/far/vmenu.cpp
+++ b/far/vmenu.cpp
@@ -2956,15 +2956,6 @@ bool VMenu::DrawItemText(
{
const segment Bounds{ TextArea.start(), segment::sentinel_tag{ TextArea.end() } };
- if (const auto Indent{ std::max(Item.HorizontalPosition, 0) }; Indent > 0)
- {
- GotoXY(Bounds.start(), Y);
- set_color(Colors, ColorIndices.Normal);
- bool AllCharsConsumed{};
- if (ClippedText(BlankLine.substr(0, Indent), Bounds, AllCharsConsumed)) return true;
- assert(WhereX() == Bounds.start() + Indent);
- }
-
const auto [ItemText, HighlightPos]{ [&]{
const auto RawItemText_{ GetItemText(Item) };
auto HotkeyPos_{ string::npos };
@@ -2978,31 +2969,43 @@ bool VMenu::DrawItemText(
return std::tuple{ ItemText_, HighlightPos_ };
}() };
- bool NeedRightHScroll{};
+ GotoXY(Bounds.start(), Y);
+ set_color(Colors, ColorIndices.Normal);
+
+ if (ItemText.empty())
+ {
+ ClippedText(BlankLine, Bounds);
+ return false;
+ }
- if (!ItemText.empty())
+ if (const auto Indent{ std::max(Item.HorizontalPosition, 0) }; Indent > 0)
{
- const segment TextSegment{ 0, segment::length_tag{ static_cast<segment::domain_t>(ItemText.size()) } };
- markup_slice_boundaries(TextSegment, Item.Annotations, HighlightPos, HighlightMarkup);
+ if (ClippedText(BlankLine.substr(0, Indent), Bounds)) return true;
+ assert(WhereX() == Bounds.start() + Indent);
+ }
+
+ bool NeedRightHScroll{};
+
+ const segment TextSegment{ 0, segment::length_tag{ static_cast<segment::domain_t>(ItemText.size()) } };
+ markup_slice_boundaries(TextSegment, Item.Annotations, HighlightPos, HighlightMarkup);
- GotoXY(Bounds.start() + Item.HorizontalPosition, Y);
+ GotoXY(Bounds.start() + Item.HorizontalPosition, Y);
- auto CurColorIndex{ ColorIndices.Normal };
- auto AltColorIndex{ ColorIndices.Highlighted };
- int CurTextPos{};
+ auto CurColorIndex{ ColorIndices.Normal };
+ auto AltColorIndex{ ColorIndices.Highlighted };
+ int CurTextPos{};
- for (const auto SliceEnd : HighlightMarkup)
+ for (const auto SliceEnd : HighlightMarkup)
+ {
+ set_color(Colors, CurColorIndex);
+ bool AllCharsConsumed{};
+ if (ClippedText(string_view{ ItemText }.substr(CurTextPos, SliceEnd - CurTextPos), Bounds, AllCharsConsumed))
{
- set_color(Colors, CurColorIndex);
- bool AllCharsConsumed{};
- if (ClippedText(string_view{ ItemText }.substr(CurTextPos, SliceEnd - CurTextPos), Bounds, AllCharsConsumed))
- {
- NeedRightHScroll = !AllCharsConsumed || SliceEnd < static_cast<int>(ItemText.size());
- break;
- }
- std::ranges::swap(CurColorIndex, AltColorIndex);
- CurTextPos = SliceEnd;
+ NeedRightHScroll = !AllCharsConsumed || SliceEnd < static_cast<int>(ItemText.size());
+ break;
}
+ std::ranges::swap(CurColorIndex, AltColorIndex);
+ CurTextPos = SliceEnd;
}
if (WhereX() < Bounds.end())