Repository :
https://github.com/FarGroup/FarManager
On branch : master
Link :
https://github.com/FarGroup/FarManager/commit/06953f425583ece6dbd5c920429e8bc31566d53c
>---------------------------------------------------------------
commit 06953f425583ece6dbd5c920429e8bc31566d53c
Author: Michael Z. Kadaner <
MKad...@users.noreply.github.com>
Date: Sun Apr 26 19:38:41 2026 -0400
gh-1000: Do not materialize text coordinates in Find All menu items.
Instead of extracting line and position of the found pattern from the item's text, macros should use Menu.GetItemExtendedData.
>---------------------------------------------------------------
06953f425583ece6dbd5c920429e8bc31566d53c
.../Macros/Edit.SyncEditorAndFindAllMenu.lua | 17 +----
far/changelog | 7 ++
far/editor.cpp | 78 +++++++++++++--------
far/vbuild.m4 | 2 +-
far/vmenu.cpp | 81 +++++++++-------------
far/vmenu.hpp | 27 ++++----
far/vmenu2.cpp | 5 --
far/vmenu2.hpp | 2 -
8 files changed, 106 insertions(+), 113 deletions(-)
diff --git a/extra/Addons/Macros/Edit.SyncEditorAndFindAllMenu.lua b/extra/Addons/Macros/Edit.SyncEditorAndFindAllMenu.lua
index e068d395f..54bff091e 100644
--- a/extra/Addons/Macros/Edit.SyncEditorAndFindAllMenu.lua
+++ b/extra/Addons/Macros/Edit.SyncEditorAndFindAllMenu.lua
@@ -107,18 +107,6 @@ local function HighlighText()
editor.Redraw(EditorInfo.EditorID);
end
--- Will be removed when items do not contain found coordinates inline
-local function GetLineNumberFixedColumns(FarDialogEvent, LineNumber)
- local ItemText = FarDialogEvent.hDlg:send(F.DM_LISTGETITEM, 1, 1).Text
-
- local LineNumberColumnWidth = 0
- if ItemText then
- LineNumberColumnWidth = #(ItemText:match("^(%s*%d+)%s") or "")
- end
-
- return string.format("%" .. LineNumberColumnWidth .. "d ", LineNumber)
-end
-
local function SetupMenuAndEditor(FarDialogEvent)
local SelectPos = 1
@@ -135,10 +123,7 @@ local function SetupMenuAndEditor(FarDialogEvent)
if SelectPos == ItemsNumber + 1 -- All occurrences precede the cursor position
-- or the current editor line does not containing an occurrence
or Menu.GetItemExtendedData(FarDialogEvent.hDlg, SelectPos).Line ~= EditorInfo.CurLine then
- FarDialogEvent.hDlg:send(F.DM_LISTINSERT,
- 1,
- { Index = SelectPos,
- Text = GetLineNumberFixedColumns(FarDialogEvent, EditorInfo.CurLine) .. Editor.GetStr(EditorInfo.CurLine) })
+ FarDialogEvent.hDlg:send(F.DM_LISTINSERT, 1, { Index = SelectPos, Text = Editor.GetStr(EditorInfo.CurLine) })
Menu.SetItemExtendedData(FarDialogEvent.hDlg, SelectPos, { Line = EditorInfo.CurLine, Position = EditorInfo.CurPos, Length = 0 })
ItemsNumber = ItemsNumber + 1
end
diff --git a/far/changelog b/far/changelog
index 0863f176b..12469efd4 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,10 @@
+--------------------------------------------------------------------------------
+MZK 2026-05-10 12:27:04-04:00 - build 6683
+
+1. gh-1000: Do not materialize text coordinates in Find All menu items.
+ Instead of extracting line and position of the found pattern
+ from the item's text, macros should use Menu.GetItemExtendedData.
+
--------------------------------------------------------------------------------
drkns 2026-05-09 12:59:44+01:00 - build 6682
diff --git a/far/editor.cpp b/far/editor.cpp
index 8057f6c1e..6253830f7 100644
--- a/far/editor.cpp
+++ b/far/editor.cpp
@@ -3526,10 +3526,7 @@ namespace
void add_item(FindCoord FoundCoords, string_view ItemText)
{
- menu_item_ex Item{ far::format(L"{:{}}{:{}}{}"sv,
- FoundCoords.Line + 1, m_LineNumColumnMaxWidth,
- FoundCoords.Pos + 1, m_FoundPosColumnMaxWidth,
- ItemText) };
+ menu_item_ex Item{ string{ ItemText } };
Item.Annotations.emplace_back(FoundCoords.Pos, segment::length_tag{ FoundCoords.SearchLen });
Item.ComplexUserData = FoundCoords;
m_Menu->AddItem(Item);
@@ -3554,25 +3551,39 @@ namespace
m_Menu->SetHelp(L"FindAllMenu"sv);
m_Menu->SetId(EditorFindAllListId);
- const short LineNumColumnWidth{ radix10_formatted_width(m_MaxLineNum + 1) };
- const short FoundPosColumnWidth{ radix10_formatted_width(m_MaxFoundPos + 1) };
- const short LineNumColumnStart{ static_cast<short>(m_LineNumColumnMaxWidth - LineNumColumnWidth) };
- const short FoundPosColumnStart{ static_cast<short>(m_LineNumColumnMaxWidth + m_FoundPosColumnMaxWidth - FoundPosColumnWidth) };
- const short ItemTextStart{ static_cast<short>(m_LineNumColumnMaxWidth + m_FoundPosColumnMaxWidth) };
- m_Menu->SetFixedColumns(
+ const auto LineNumColumnWidth{ radix10_formatted_width(m_MaxLineNum + 1) };
+ const auto FoundPosColumnWidth{ radix10_formatted_width(m_MaxFoundPos + 1) };
+ m_Menu->ListBox().RegisterFixedColumnsProvider(
{
{
- .TextSegment{ LineNumColumnStart, segment::length_tag{ LineNumColumnWidth } },
+ .MaxWidth = LineNumColumnWidth,
.CurrentWidth = LineNumColumnWidth,
- .Separator = BoxSymbols[BS_V1]
+ .Separator = BoxSymbols[BS_V1],
+ .ColumnId = 0,
},
{
- .TextSegment{ FoundPosColumnStart, segment::length_tag{ FoundPosColumnWidth } },
+ .MaxWidth = FoundPosColumnWidth,
.CurrentWidth = FoundPosColumnWidth,
- .Separator = BoxSymbols[BS_V1]
+ .Separator = BoxSymbols[BS_V1],
+ .ColumnId = 1,
},
},
- segment::ray(ItemTextStart)
+ [](const menu_item_ex& Item, const VMenu::fixed_column_t& Column)
+ {
+ if (const auto* Coord{ std::any_cast<FindCoord>(&Item.ComplexUserData) })
+ {
+ switch (Column.ColumnId)
+ {
+ case 0: // Line Number
+ return far::format(L"{:{}}"sv, Coord->Line + 1, Column.MaxWidth);
+
+ case 1: // Found Position
+ return far::format(L"{:{}}"sv, Coord->Pos + 1, Column.MaxWidth);
+ }
+ }
+
+ return string{};
+ }
);
m_Menu->ListBox().RegisterExtendedDataProvider(
[](const menu_item_ex& Item, VMenu::extended_item_data& ExtendedData)
@@ -4022,8 +4033,11 @@ void Editor::DoSearchReplace(const SearchReplaceDisposition Disposition)
if (SelectedPos == -1)
break;
- SelectFoundPattern(*FindAllList->m_Menu->GetComplexUserDataPtr<FindCoord>(SelectedPos));
- Refresh();
+ if (const auto* Coord{ FindAllList->m_Menu->GetComplexUserDataPtr<FindCoord>(SelectedPos) })
+ {
+ SelectFoundPattern(*Coord);
+ Refresh();
+ }
}
break;
@@ -4087,8 +4101,11 @@ void Editor::DoSearchReplace(const SearchReplaceDisposition Disposition)
if(ExitCode >= 0)
{
- SelectFoundPattern(*FindAllList->m_Menu->GetComplexUserDataPtr<FindCoord>(ExitCode));
- Show();
+ if (const auto* Coord{ FindAllList->m_Menu->GetComplexUserDataPtr<FindCoord>(ExitCode) })
+ {
+ SelectFoundPattern(*Coord);
+ Show();
+ }
}
}
@@ -4138,26 +4155,29 @@ void Editor::SaveFoundItemsToNewEditor(const VMenu& ListBox, const bool Matching
{
if (Item.Flags & FilterFlags) continue;
- const auto ThisEditorCoord{ std::any_cast<FindCoord>(Item.ComplexUserData) };
+ const auto* ThisEditorCoord{ std::any_cast<FindCoord>(&Item.ComplexUserData) };
+ if (!ThisEditorCoord) continue;
- if (ThisEditorCoord.Line != ThisEditorLastLine)
+ if (ThisEditorCoord->Line != ThisEditorLastLine)
{
- ThisEditorLastLine = ThisEditorCoord.Line;
+ ThisEditorLastLine = ThisEditorCoord->Line;
- const auto CurString{ GetStringByNumber(ThisEditorCoord.Line) };
+ const auto CurString{ GetStringByNumber(ThisEditorCoord->Line) };
const auto NewEditorLine{ NewEditor.InsertString(CurString->GetString(), NewEditor.LastLine()) };
NewEditorLine->SetEOL(CurString->GetEOL());
}
if (static_cast<intptr_t>(Index) == ExitCode)
{
- const auto CurrentFoundCoord{ *ListBox.GetComplexUserDataPtr<const FindCoord>(ExitCode) };
- NewEditorFoundCoord =
+ if (const auto* CurrentFoundCoord{ ListBox.GetComplexUserDataPtr<const FindCoord>(ExitCode) })
{
- .Line = std::prev(NewEditor.LastLine()).Number(),
- .Pos = CurrentFoundCoord.Pos,
- .SearchLen = CurrentFoundCoord.SearchLen
- };
+ NewEditorFoundCoord =
+ {
+ .Line = std::prev(NewEditor.LastLine()).Number(),
+ .Pos = CurrentFoundCoord->Pos,
+ .SearchLen = CurrentFoundCoord->SearchLen
+ };
+ }
}
}
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index 8d860c8b2..b0a092ba7 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6682
+6683
diff --git a/far/vmenu.cpp b/far/vmenu.cpp
index 3f99362db..4332713c0 100644
--- a/far/vmenu.cpp
+++ b/far/vmenu.cpp
@@ -556,11 +556,9 @@ namespace
return !(Item.Flags & (LIF_HIDDEN | LIF_FILTERED));
}
- string_view get_item_cell_text(string_view ItemName, segment CellSegment)
+ string_view get_item_text(const menu_item_ex& Item)
{
- const auto Intersection{ intersect(segment{ 0, segment::length_tag{ static_cast<segment::domain_t>(ItemName.size()) } }, CellSegment) };
- if (Intersection.empty()) return {};
- return ItemName.substr(Intersection.start(), Intersection.length());
+ return Item.Name;
}
std::pair<int, int> item_hpos_limits(const int ItemLength, const int TextAreaWidth, const item_hscroll_policy Policy) noexcept
@@ -629,14 +627,14 @@ namespace
return -adjust_hpos_shift(-Shift, TextAreaWidth - Right, TextAreaWidth - Left, TextAreaWidth);
}
- void toggle_fixed_columns(std::vector<vmenu_fixed_column_t>& FixedColumns)
+ void toggle_fixed_columns(std::vector<VMenu::fixed_column_t>& FixedColumns)
{
assert(!FixedColumns.empty());
- if (auto firstHiddenColumn{ std::ranges::find(FixedColumns, 0, &vmenu_fixed_column_t::CurrentWidth) };
+ if (auto firstHiddenColumn{ std::ranges::find(FixedColumns, 0, &VMenu::fixed_column_t::CurrentWidth) };
firstHiddenColumn != FixedColumns.end())
{
- firstHiddenColumn->CurrentWidth = firstHiddenColumn->TextSegment.length();
+ firstHiddenColumn->CurrentWidth = firstHiddenColumn->MaxWidth;
return;
}
@@ -1087,7 +1085,6 @@ void VMenu::clear()
m_MaxItemLength = 0;
m_HorizontalTracker->clear();
m_FixedColumns.clear();
- m_ItemTextSegment = segment::ray();
SetMenuFlags(VMENU_UPDATEREQUIRED);
}
@@ -1193,7 +1190,7 @@ void VMenu::FilterStringUpdated()
ItemHiddenCount++;
}
- if (CurItem.Name.empty() && PrevGroup == -1)
+ if (get_item_text(CurItem).empty() && PrevGroup == -1)
{
CurItem.Flags |= LIF_FILTERED;
ItemHiddenCount++;
@@ -1206,7 +1203,7 @@ void VMenu::FilterStringUpdated()
}
else
{
- if(!contains_icase(remove_highlight(trim(CurItem.Name)), strFilter))
+ if(!contains_icase(remove_highlight(trim(get_item_text(CurItem))), strFilter))
{
CurItem.Flags |= LIF_FILTERED;
ItemHiddenCount++;
@@ -1378,7 +1375,7 @@ long long VMenu::VMProcess(int OpCode, void* vParam, long long iParam)
continue;
int Res = 0;
- const auto strTemp = trim(remove_highlight(Item.Name));
+ const auto strTemp = trim(remove_highlight(get_item_text(Item)));
switch (iParam)
{
@@ -2489,7 +2486,7 @@ bool VMenu::AlignAnnotations()
return SetAllItemsHPos(
[&](const menu_item_ex& Item)
{
- return AlignPos - static_cast<int>(visual_string_length(GetItemText(Item).substr(0, Item.SafeGetFirstAnnotation())));
+ return AlignPos - static_cast<int>(visual_string_length(get_item_text(Item).substr(0, Item.SafeGetFirstAnnotation())));
});
}
@@ -2851,7 +2848,7 @@ void VMenu::ConnectSeparator(const size_t ItemIndex, string& separator, const in
// We should think of how to deal with fixed columns and horizontally shifted items.
// Maybe use fixed columns in the menus where it is necessary
// and connect separators in trivial cases only (or not at all)?
- if (CheckFlags(VMENU_NOMERGEBORDER) || !m_FixedColumns.empty() || m_ItemTextSegment.start() > 0 || separator.size() <= 3)
+ if (CheckFlags(VMENU_NOMERGEBORDER) || !m_FixedColumns.empty() || separator.size() <= 3)
return;
for (const auto I : std::views::iota(0uz, separator.size() - 3))
@@ -2939,11 +2936,11 @@ void VMenu::DrawFixedColumns(
set_color(Colors, ColorIndices.Normal);
auto CurCellAreaStart{ FixedColumnsArea.start() };
- for (const auto CurFixedColumn : m_FixedColumns | std::views::filter(&vmenu_fixed_column_t::CurrentWidth))
+ for (const auto CurFixedColumn : m_FixedColumns | std::views::filter(&VMenu::fixed_column_t::CurrentWidth))
{
const segment CellArea{ CurCellAreaStart, segment::length_tag{ CurFixedColumn.CurrentWidth } };
- const auto CellText{ get_item_cell_text(Item.Name, CurFixedColumn.TextSegment) };
+ const auto CellText{ m_FixedColumnProvider(Item, CurFixedColumn) };
if (!ClippedText(CellText, CellArea))
ClippedText(BlankLine, CellArea);
@@ -2967,7 +2964,7 @@ bool VMenu::DrawItemText(
const segment Bounds{ TextArea.start(), segment::sentinel_tag{ TextArea.end() } };
const auto [ItemText, HighlightPos]{ [&]{
- const auto RawItemText_{ GetItemText(Item) };
+ const auto RawItemText_{ get_item_text(Item) };
auto HotkeyPos_{ string::npos };
auto ItemText_{ CheckFlags(VMENU_SHOWAMPERSAND) ? string{ RawItemText_ } : HiText2Str(RawItemText_, &HotkeyPos_) };
std::ranges::replace(ItemText_, L'\t', L' ');
@@ -3065,7 +3062,7 @@ wchar_t VMenu::GetHighlights(const menu_item_ex* const Item) const
return 0;
wchar_t Ch;
- return HiTextHotkey(GetItemText(*Item), Ch)? Ch : 0;
+ return HiTextHotkey(get_item_text(*Item), Ch)? Ch : 0;
}
void VMenu::AssignHighlights(const menu_layout& Layout)
@@ -3119,7 +3116,7 @@ void VMenu::AssignHighlights(const menu_layout& Layout)
wchar_t Hotkey{};
size_t HotkeyVisualPos{};
// TODO: проверка на LIF_HIDDEN
- if (HiTextHotkey(GetItemText(Item), Hotkey, &HotkeyVisualPos) && RegisterHotkey(Hotkey))
+ if (HiTextHotkey(get_item_text(Item), Hotkey, &HotkeyVisualPos) && RegisterHotkey(Hotkey))
SetItemHotkey(Item, Hotkey, HotkeyVisualPos);
else
ClearItemHotkey(Item);
@@ -3131,7 +3128,7 @@ void VMenu::AssignHighlights(const menu_layout& Layout)
auto& Item{ Items[I] };
if (Item.AutoHotkey) continue;
- const auto ItemText = GetItemText(Item);
+ const auto ItemText = get_item_text(Item);
const auto VisibleTextSegment{ intersect(
segment{ 0, segment::length_tag{ static_cast<segment::domain_t>(ItemText.size()) } },
segment::ray(-Item.HorizontalPosition)) };
@@ -3163,7 +3160,7 @@ bool VMenu::CheckKeyHiOrAcc(DWORD Key, int Type, bool Translate, bool ChangePos,
if ((!Type && Item.AccelKey && Key == Item.AccelKey)
|| (Type
&& (Item.AutoHotkey || !CheckFlags(VMENU_SHOWAMPERSAND))
- && IsKeyHighlighted(GetItemText(Item), Key, Translate, Item.AutoHotkey)))
+ && IsKeyHighlighted(get_item_text(Item), Key, Translate, Item.AutoHotkey)))
{
NewPos = static_cast<int>(std::ranges::distance(Items.data(), &Item));
if (ChangePos)
@@ -3186,9 +3183,7 @@ bool VMenu::CheckKeyHiOrAcc(DWORD Key, int Type, bool Translate, bool ChangePos,
void VMenu::UpdateMaxLength(int const ItemLength)
{
- m_MaxItemLength = std::max(
- m_MaxItemLength,
- intersect(segment{ 0, segment::length_tag{ ItemLength } }, m_ItemTextSegment).length());
+ m_MaxItemLength = std::max(m_MaxItemLength, ItemLength);
}
void VMenu::SetMaxHeight(int NewMaxHeight)
@@ -3222,16 +3217,6 @@ void VMenu::SetTitle(string_view const Title)
strTitle = Title;
}
-void VMenu::SetFixedColumns(std::vector<vmenu_fixed_column_t>&& FixedColumns, segment ItemTextSegment)
-{
- m_FixedColumns = std::move(FixedColumns);
- for (auto& column : m_FixedColumns)
- {
- column.CurrentWidth = std::clamp(column.CurrentWidth, int{}, column.TextSegment.length());
- }
- m_ItemTextSegment = ItemTextSegment;
-}
-
void VMenu::ResizeConsole()
{
if (SaveScr)
@@ -3467,6 +3452,16 @@ std::any* VMenu::GetComplexUserData(int Position)
return &Items[ItemPos].ComplexUserData;
}
+void VMenu::RegisterFixedColumnsProvider(std::vector<fixed_column_t>&& FixedColumns, fixed_column_provider&& FixedColumnProvider)
+{
+ m_FixedColumns = std::move(FixedColumns);
+ for (auto& column : m_FixedColumns)
+ {
+ column.CurrentWidth = std::clamp(column.CurrentWidth, int{}, column.MaxWidth);
+ }
+ m_FixedColumnProvider = std::move(FixedColumnProvider);
+}
+
void VMenu::RegisterExtendedDataProvider(extended_item_data_getter&& ExtendedDataGetter, extended_item_data_setter&& ExtendedDataSetter)
{
m_ExtendedDataGetter = std::move(ExtendedDataGetter);
@@ -3513,9 +3508,7 @@ int VMenu::FindItem(int StartIndex, string_view const Pattern, unsigned long lon
{
for (const auto I: std::views::iota(static_cast<size_t>(StartIndex), Items.size()))
{
- // Consider: Strictly speaking, we should remove highlight
- // only within m_ItemTextSegment leaving everything else intact.
- const auto strTmpBuf = remove_highlight(Items[I].Name);
+ const auto strTmpBuf = remove_highlight(get_item_text(Items[I]));
if (Flags&LIFIND_EXACTMATCH)
{
@@ -3539,11 +3532,9 @@ void VMenu::SortItems(bool Reverse, int Offset)
{
SortItems([](const menu_item_ex& a, const menu_item_ex& b, const SortItemParam& Param)
{
- // Consider: Strictly speaking, we should remove highlight
- // only within m_ItemTextSegment leaving everything else intact.
const auto
- strName1 = remove_highlight(a.Name),
- strName2 = remove_highlight(b.Name);
+ strName1 = remove_highlight(get_item_text(a)),
+ strName2 = remove_highlight(get_item_text(b));
const auto Less = string_sort::less(string_view(strName1).substr(Param.Offset), string_view(strName2).substr(Param.Offset));
return Param.Reverse? !Less : Less;
@@ -3562,6 +3553,7 @@ bool VMenu::Pack()
{
if (!(Items[FirstIndex].Flags & LIF_SEPARATOR) && !(Items[LastIndex].Flags & LIF_SEPARATOR))
{
+ // Not using get_item_text because... just in case
if (Items[FirstIndex].Name == Items[LastIndex].Name)
{
DeleteItem(static_cast<int>(LastIndex));
@@ -3634,13 +3626,8 @@ int VMenu::CalculateTextAreaWidth() const
int VMenu::GetItemVisualLength(const menu_item_ex& Item) const
{
- const auto ItemCellText{ get_item_cell_text(Item.Name, m_ItemTextSegment) };
- return static_cast<int>(CheckFlags(VMENU_SHOWAMPERSAND) ? visual_string_length(ItemCellText) : HiStrlen(ItemCellText));
-}
-
-string_view VMenu::GetItemText(const menu_item_ex& Item) const
-{
- return get_item_cell_text(Item.Name, m_ItemTextSegment);
+ const auto ItemText{ get_item_text(Item) };
+ return static_cast<int>(CheckFlags(VMENU_SHOWAMPERSAND) ? visual_string_length(ItemText) : HiStrlen(ItemText));
}
#ifdef ENABLE_TESTS
diff --git a/far/vmenu.hpp b/far/vmenu.hpp
index 7ee3fc740..c8dd2d85e 100644
--- a/far/vmenu.hpp
+++ b/far/vmenu.hpp
@@ -152,13 +152,6 @@ struct item_color_indices;
struct menu_layout;
class vmenu_horizontal_tracker;
-struct vmenu_fixed_column_t
-{
- segment TextSegment;
- int CurrentWidth;
- wchar_t Separator;
-};
-
struct SortItemParam
{
bool Reverse;
@@ -196,7 +189,6 @@ public:
void SetDialogStyle(bool Style) { ChangeFlags(VMENU_WARNDIALOG, Style); SetColors(nullptr); }
void SetUpdateRequired(bool SetUpdate) { ChangeFlags(VMENU_UPDATEREQUIRED, SetUpdate); }
void SetMenuFlags(DWORD Flags) { VMFlags.Set(Flags); }
- void SetFixedColumns(std::vector<vmenu_fixed_column_t>&& FixedColumns, segment ItemTextSegment);
void ClearFlags(DWORD Flags) { VMFlags.Clear(Flags); }
bool CheckFlags(DWORD Flags) const { return VMFlags.Check(Flags); }
DWORD GetFlags() const { return VMFlags.Flags(); }
@@ -246,6 +238,16 @@ public:
}
void SetComplexUserData(const std::any& Data, int Position = -1);
+ struct fixed_column_t
+ {
+ int MaxWidth;
+ int CurrentWidth;
+ wchar_t Separator;
+ short ColumnId;
+ };
+ using fixed_column_provider = std::function<string(const menu_item_ex&, const fixed_column_t&)>;
+ void RegisterFixedColumnsProvider(std::vector<fixed_column_t>&& FixedColumns, fixed_column_provider&& FixedColumnProvider);
+
using extended_item_data = std::vector<std::pair<FarMacroValue, FarMacroValue>>;
using extended_item_data_getter = std::function<bool(const menu_item_ex&, extended_item_data&)>;
using extended_item_data_setter = std::function<bool(menu_item_ex&, const extended_item_data&)>;
@@ -323,8 +325,7 @@ private:
string_view BlankLine) const;
[[nodiscard]] int CalculateTextAreaWidth() const;
- [[nodiscard]] int GetItemVisualLength(const menu_item_ex& Item) const; // Intersected with m_ItemTextSegment
- [[nodiscard]] string_view GetItemText(const menu_item_ex& Item) const; // Intersected with m_ItemTextSegment
+ [[nodiscard]] int GetItemVisualLength(const menu_item_ex& Item) const;
int GetItemPosition(int Position) const;
bool CheckKeyHiOrAcc(DWORD Key, int Type, bool Translate, bool ChangePos, int& NewPos);
@@ -356,10 +357,10 @@ private:
int TopPos{};
int MaxHeight;
bool WasAutoHeight{};
- int m_MaxItemLength{}; // Each Item.Name is intersected with m_ItemTextSegment
+ int m_MaxItemLength{};
std::unique_ptr<vmenu_horizontal_tracker> m_HorizontalTracker;
- std::vector<vmenu_fixed_column_t> m_FixedColumns;
- segment m_ItemTextSegment{ segment::ray() };
+ std::vector<fixed_column_t> m_FixedColumns;
+ fixed_column_provider m_FixedColumnProvider;
extended_item_data_getter m_ExtendedDataGetter;
extended_item_data_setter m_ExtendedDataSetter;
window_ptr CurrentWindow;
diff --git a/far/vmenu2.cpp b/far/vmenu2.cpp
index 82811dbe0..bc74dddbe 100644
--- a/far/vmenu2.cpp
+++ b/far/vmenu2.cpp
@@ -408,11 +408,6 @@ void VMenu2::SetMenuFlags(DWORD Flags)
SendMessage(DM_SETDLGITEMSHORT, 0, &fdi);
}
-void VMenu2::SetFixedColumns(std::vector<vmenu_fixed_column_t>&& FixedColumns, const segment ItemTextSegment)
-{
- ListBox().SetFixedColumns(std::move(FixedColumns), ItemTextSegment);
-}
-
void VMenu2::EnableAutoHighlight(bool Reverse)
{
SetMenuFlags(VMENU_AUTOHIGHLIGHT | (Reverse? VMENU_REVERSEHIGHLIGHT : VMENU_NONE));
diff --git a/far/vmenu2.hpp b/far/vmenu2.hpp
index 8a6d7f998..cece2b7e7 100644
--- a/far/vmenu2.hpp
+++ b/far/vmenu2.hpp
@@ -49,7 +49,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct menu_item;
struct menu_item_ex;
-struct vmenu_fixed_column_t;
struct SortItemParam;
class VMenu2 final: public Dialog
@@ -72,7 +71,6 @@ public:
void SetBottomTitle(const string& Title);
void SetBoxType(int BoxType);
void SetMenuFlags(DWORD Flags);
- void SetFixedColumns(std::vector<vmenu_fixed_column_t>&& FixedColumns, segment ItemTextSegment);
void EnableAutoHighlight(bool Reverse = false);
void clear();
int DeleteItem(int ID,int Count=1);