Skip to content

Commit 6fcb083

Browse files
committed
bette auto size calculation
1 parent 0f927bc commit 6fcb083

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/gitfetch/display.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _calculate_compact_dimensions(self, username: str,
118118
contrib_graph = stats.get('contribution_graph', [])
119119
recent_weeks = self._get_recent_weeks(contrib_graph)
120120
graph_width = (self.custom_width if self.custom_width is not None
121-
else max(40, (self.terminal_width - 40) // 2))
121+
else max(40, (self.terminal_width - 40) * 3 // 4))
122122

123123
if self.show_grid:
124124
# Use custom height for graph height
@@ -154,7 +154,8 @@ def _calculate_full_dimensions(self, username: str,
154154
stats: Dict[str, Any]) -> tuple:
155155
"""Calculate dimensions for full layout."""
156156
contrib_graph = stats.get('contribution_graph', [])
157-
graph_width = max(50, (self.terminal_width - 10) // 2)
157+
graph_width = (self.custom_width if self.custom_width is not None
158+
else max(50, (self.terminal_width - 10) * 3 // 4))
158159

159160
left_side = []
160161
if self.show_grid:
@@ -274,7 +275,7 @@ def _display_compact(self, username: str, user_data: Dict[str, Any],
274275

275276
contrib_graph = stats.get('contribution_graph', [])
276277
recent_weeks = self._get_recent_weeks(contrib_graph)
277-
graph_width = max(40, (self.terminal_width - 40) // 2)
278+
graph_width = max(40, (self.terminal_width - 40) * 3 // 4)
278279

279280
if self.show_grid:
280281
graph_lines = self._get_contribution_graph_lines(
@@ -350,7 +351,8 @@ def _display_full(self, username: str, user_data: Dict[str, Any],
350351
return
351352

352353
contrib_graph = stats.get('contribution_graph', [])
353-
graph_width = max(50, (self.terminal_width - 10) // 2)
354+
graph_width = (self.custom_width if self.custom_width is not None
355+
else max(50, (self.terminal_width - 10) * 3 // 4))
354356

355357
left_side = []
356358
if self.show_grid:

0 commit comments

Comments
 (0)