Skip to content

Commit

Permalink
Make puristic compilers happy
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Feb 12, 2025
1 parent f9adc82 commit 1e5b5c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
drkns 2025-02-12 21:01:13+00:00 - build 6439

1. Make puristic compilers happy.

--------------------------------------------------------------------------------
drkns 2025-02-12 19:48:48+00:00 - build 6438

Expand Down
14 changes: 9 additions & 5 deletions far/setcolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ struct color_item
PaletteColors Color;
// libc++ decided to follow the standard literally and prohibit incomplete types in spans :(
color_item_span SubColor;
PaletteColors const* BottomColor;
// Puristic compilers don't accept pointers to incomplete types in constexpr
// 1-based, 0 means none
size_t BottomColorIndex1Based;
};

constexpr color_item_span::operator std::span<color_item const>() const
Expand Down Expand Up @@ -167,7 +169,9 @@ static void SetItemColors(std::span<const color_item> const Items, point Positio
}
else
{
ChangeColor(Items[ItemsCode].Color, Items[ItemsCode].BottomColor);
const auto BottomColorIndex = Items[ItemsCode].BottomColorIndex1Based;
const auto BottomColor = BottomColorIndex? &Items[BottomColorIndex - 1].Color : nullptr;
ChangeColor(Items[ItemsCode].Color, BottomColor);
}

return 1;
Expand All @@ -193,8 +197,8 @@ void SetColors()
{ lng::MSetColorPanelHighlightedInfo, COL_PANELINFOTEXT },
{ lng::MSetColorPanelDragging, COL_PANELDRAGTEXT },
{ lng::MSetColorPanelBox, COL_PANELBOX },
{ lng::MSetColorPanelNormalCursor, COL_PANELCURSOR, {}, &PanelItems[0].Color },
{ lng::MSetColorPanelSelectedCursor, COL_PANELSELECTEDCURSOR, {}, &PanelItems[1].Color },
{ lng::MSetColorPanelNormalCursor, COL_PANELCURSOR, {}, 1 + 0 },
{ lng::MSetColorPanelSelectedCursor, COL_PANELSELECTEDCURSOR, {}, 1 + 1 },
{ lng::MSetColorPanelNormalTitle, COL_PANELTITLE },
{ lng::MSetColorPanelSelectedTitle, COL_PANELSELECTEDTITLE },
{ lng::MSetColorPanelColumnTitle, COL_PANELCOLUMNTITLE },
Expand Down Expand Up @@ -379,7 +383,7 @@ void SetColors()
EditorItems[]
{
{ lng::MSetColorEditorNormal, COL_EDITORTEXT },
{ lng::MSetColorEditorSelected, COL_EDITORSELECTEDTEXT, {}, &EditorItems[0].Color },
{ lng::MSetColorEditorSelected, COL_EDITORSELECTEDTEXT, {}, 1 + 0 },
{ lng::MSetColorEditorStatus, COL_EDITORSTATUS },
{ lng::MSetColorEditorScrollbar, COL_EDITORSCROLLBAR },
},
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6438
6439

0 comments on commit 1e5b5c8

Please sign in to comment.