Skip to content

Commit a3234e7

Browse files
committed
refactor: remove unnecessary whitespaces
1 parent 3645697 commit a3234e7

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/cli/ui/Dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ protected function renderFullscreen(): void
14751475
if ($this->fullscreenPane === Layout::PANE_QUERIES) {
14761476
// Don't clear entire screen for queries pane - only clear header and footer
14771477
// Content area is cleared by ActiveQueriesPane::render() to avoid flickering
1478-
1478+
14791479
// Calculate scroll offset for fullscreen
14801480
$queries = $this->cachedQueries;
14811481
// Header: row 1, Table header: row 2, Footer: row $rows

src/cli/ui/panes/ActiveQueriesPane.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,35 +87,35 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
8787
// Clear only the content area, not the entire line (to preserve right border)
8888
echo str_repeat(' ', $availableWidth);
8989
Terminal::moveTo($content['row'], $content['col']);
90-
90+
9191
// Build header with UTF-8 aware padding
9292
$headerId = 'ID';
9393
$headerTime = 'Time';
9494
$headerDb = 'DB';
9595
$headerQuery = 'Query';
96-
96+
9797
$idLen = mb_strlen($headerId, 'UTF-8');
9898
$timeLen = mb_strlen($headerTime, 'UTF-8');
9999
$dbLen = mb_strlen($headerDb, 'UTF-8');
100-
100+
101101
$headerIdPadded = $headerId . str_repeat(' ', max(0, $colWidth - $idLen));
102102
$headerTimePadded = $headerTime . str_repeat(' ', max(0, $colWidth - $timeLen));
103103
$headerDbPadded = $headerDb . str_repeat(' ', max(0, $colWidth - $dbLen));
104-
104+
105105
// Calculate available width for Query header
106106
$usedWidth = ($colWidth * 3);
107107
$queryHeaderWidth = max(1, $availableWidth - $usedWidth);
108-
$headerQueryTruncated = mb_strlen($headerQuery, 'UTF-8') > $queryHeaderWidth
108+
$headerQueryTruncated = mb_strlen($headerQuery, 'UTF-8') > $queryHeaderWidth
109109
? mb_substr($headerQuery, 0, $queryHeaderWidth, 'UTF-8')
110110
: $headerQuery;
111-
111+
112112
$headerText = $headerIdPadded . $headerTimePadded . $headerDbPadded . $headerQueryTruncated;
113-
113+
114114
// Final safety check
115115
if (mb_strlen($headerText, 'UTF-8') > $availableWidth) {
116116
$headerText = mb_substr($headerText, 0, $availableWidth, 'UTF-8');
117117
}
118-
118+
119119
echo $headerText;
120120
Terminal::reset();
121121

@@ -167,41 +167,41 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
167167
}
168168

169169
$marker = $isSelected ? '> ' : ' ';
170-
170+
171171
// Build row text with proper padding (using UTF-8 aware length)
172172
$idPadded = $id;
173173
$timePadded = $time;
174174
$dbNamePadded = $dbName;
175-
175+
176176
// Pad using UTF-8 aware method
177177
$idLen = mb_strlen($id, 'UTF-8');
178178
if ($idLen < $colWidth) {
179179
$idPadded = $id . str_repeat(' ', $colWidth - $idLen);
180180
}
181-
181+
182182
$timeLen = mb_strlen($time, 'UTF-8');
183183
if ($timeLen < $colWidth) {
184184
$timePadded = $time . str_repeat(' ', $colWidth - $timeLen);
185185
}
186-
186+
187187
$dbNameLen = mb_strlen($dbName, 'UTF-8');
188188
if ($dbNameLen < $colWidth) {
189189
$dbNamePadded = $dbName . str_repeat(' ', $colWidth - $dbNameLen);
190190
}
191-
191+
192192
// Calculate actual used width after padding
193193
$markerWidth = mb_strlen($marker, 'UTF-8');
194194
$idPaddedWidth = mb_strlen($idPadded, 'UTF-8');
195195
$timePaddedWidth = mb_strlen($timePadded, 'UTF-8');
196196
$dbNamePaddedWidth = mb_strlen($dbNamePadded, 'UTF-8');
197197
$usedWidth = $markerWidth + $idPaddedWidth + $timePaddedWidth + $dbNamePaddedWidth;
198-
198+
199199
// Calculate available width for query text
200200
$queryTextWidth = max(1, $availableWidth - $usedWidth);
201201
$queryText = self::truncate((string)($query['query'] ?? ''), $queryTextWidth);
202-
202+
203203
$rowText = $marker . $idPadded . $timePadded . $dbNamePadded . $queryText;
204-
204+
205205
// Final safety check - ensure total width doesn't exceed available width
206206
$totalWidth = mb_strlen($rowText, 'UTF-8');
207207
if ($totalWidth > $availableWidth) {
@@ -214,14 +214,14 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
214214
$rowText = mb_substr($rowText, 0, $availableWidth, 'UTF-8');
215215
}
216216
}
217-
217+
218218
// Ensure we don't output more than available width (strict check)
219219
$finalWidth = mb_strlen($rowText, 'UTF-8');
220220
if ($finalWidth > $availableWidth) {
221221
// Truncate to exact available width
222222
$rowText = mb_substr($rowText, 0, $availableWidth, 'UTF-8');
223223
}
224-
224+
225225
// Output text and pad to exact width to ensure we don't overwrite anything
226226
echo $rowText;
227227
$actualWidth = mb_strlen($rowText, 'UTF-8');
@@ -230,7 +230,7 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
230230
echo str_repeat(' ', $availableWidth - $actualWidth);
231231
}
232232
Terminal::reset();
233-
233+
234234
$lastDisplayRow = $displayRow; // Update last displayed row
235235
}
236236

@@ -243,7 +243,7 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
243243
} else {
244244
$maxRow = $content['row'] + $content['height'] - 1; // Scroll indicator row
245245
}
246-
246+
247247
for ($row = $lastDisplayRow + 1; $row < $maxRow; $row++) {
248248
Terminal::moveTo($row, $content['col']);
249249
// Clear only the content area, not the entire line (to preserve right border)
@@ -259,7 +259,7 @@ public static function render(PdoDb $db, Layout $layout, int $paneIndex, bool $a
259259
} else {
260260
$scrollIndicatorRow = $content['row'] + $content['height'] - 1;
261261
}
262-
262+
263263
if ($scrollOffset > 0 || $endIdx < count($queries)) {
264264
Terminal::moveTo($scrollIndicatorRow, $content['col']);
265265
// Clear only the content area, not the entire line (to preserve right border)

0 commit comments

Comments
 (0)