diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListView.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListView.mm index a6e88feb1..5cd44c78e 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListView.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListView.mm @@ -354,6 +354,23 @@ - (void)calculateItemLayout if( m_TableView ) m_TableView.rowHeight = m_Geometry.LineHeight(); + + // By default the offset of the title in the header cell is the same as the default offset in the geometry + for( auto column : {m_ExtensionColumn, + m_SizeColumn, + m_DateCreatedColumn, + m_DateAddedColumn, + m_DateModifiedColumn, + m_DateAccessedColumn, + m_TagsColumn} ) { + if( auto cell = objc_cast(column.headerCell) ) { + cell.leftOffset = static_cast(m_Geometry.LeftInset()); + } + } + // But for the filename column the offset is special + if( auto cell = objc_cast(m_NameColumn.headerCell) ) { + cell.leftOffset = static_cast(m_Geometry.FilenameOffsetInColumn()); + } } - (void)setupIconsPxSize diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.h b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.h index a9f2ad6b4..01bb403ea 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.h +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.h @@ -19,6 +19,9 @@ class PanelListViewGeometry short RightInset() const { return 5; } short BottomInset() const { return 1; } + // Returns the the left offset of the filename text in its column + short FilenameOffsetInColumn() const noexcept; + private: short m_LineHeight; short m_TextBaseLine; diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.mm index fcd69dae4..0117f4d6f 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewGeometry.mm @@ -80,4 +80,9 @@ std::tie(m_LineHeight, m_TextBaseLine, m_IconSize) = GrabGeometryFromSystemFont(_font, _icon_scale); } +short PanelListViewGeometry::FilenameOffsetInColumn() const noexcept +{ + return static_cast(IconSize() ? 2 * LeftInset() + IconSize() : LeftInset()); +} + } // namespace nc::panel diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewNameView.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewNameView.mm index 289f19ba6..af3834e53 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewNameView.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/List/PanelListViewNameView.mm @@ -101,7 +101,7 @@ - (void)setFilename:(NSString *)_filename andTags:(std::span Any { @@ -90,7 +91,6 @@ public class PanelListViewTableHeaderCell: NSTableHeaderCell { } // Now draw the column title - let left_padding = Double(4) var trc = drawingRect(forBounds: cellFrame) trc.size.height -= 1 // eaten by the horizontal separator at the bottom trc.size.width -= 1 // eatern by the vertical separator at the right @@ -109,7 +109,7 @@ public class PanelListViewTableHeaderCell: NSTableHeaderCell { if self.alignment == NSTextAlignment.right { trc = NSMakeRect(trc.origin.x, top, trc.size.width, height) } else if self.alignment == NSTextAlignment.left { - trc = NSMakeRect(trc.origin.x + left_padding, top, trc.size.width - left_padding, height) + trc = NSMakeRect(trc.origin.x + leftOffset, top, trc.size.width - leftOffset, height) } else { // center trc = NSMakeRect(trc.origin.x, top, trc.size.width, height) }