Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19605139
D11328.id27199.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11328.id27199.diff
View Options
diff --git a/src/console/PhutilConsoleTable.php b/src/console/PhutilConsoleTable.php
--- a/src/console/PhutilConsoleTable.php
+++ b/src/console/PhutilConsoleTable.php
@@ -124,12 +124,18 @@
$columns = array();
foreach ($this->columns as $key => $column) {
- $columns[] = PhutilConsoleFormatter::formatString(
- '**%s**',
- $this->alignString(
+ if ($this->shouldNotAddSpacing($key, $column)) {
+ $column_str = $column['title'];
+ } else {
+ $column_str = $this->alignString(
$column['title'],
$this->getWidth($key),
- idx($column, 'align', self::ALIGN_LEFT)));
+ idx($column, 'align', self::ALIGN_LEFT));
+ }
+
+ $columns[] = PhutilConsoleFormatter::formatString(
+ '**%s**',
+ $column_str);
}
$output .= $this->formatRow($columns);
@@ -148,10 +154,14 @@
$columns = array();
foreach ($this->columns as $key => $column) {
- $columns[] = $this->alignString(
- (string)idx($data, $key, ''),
- $this->getWidth($key),
- idx($column, 'align', self::ALIGN_LEFT));
+ if ($this->shouldNotAddSpacing($key, $column)) {
+ $columns[] = (string)idx($data, $key, '');
+ } else {
+ $columns[] = $this->alignString(
+ (string)idx($data, $key, ''),
+ $this->getWidth($key),
+ idx($column, 'align', self::ALIGN_LEFT));
+ }
}
$output .= $this->formatRow($columns);
@@ -180,6 +190,27 @@
/* -( Internals )---------------------------------------------------------- */
/**
+ * Returns if the specified column should have spacing added.
+ *
+ * @return bool
+ */
+ private function shouldNotAddSpacing($key, $column) {
+ if (!$this->borders) {
+ if (last_key($this->columns) === $key) {
+ if (idx($column, 'align', self::ALIGN_LEFT) === self::ALIGN_LEFT) {
+ // Don't add extra spaces to this column since it's the last column,
+ // left aligned, and we're not showing borders. This prevents
+ // unnecessary empty lines from appearing when the extra spaces
+ // wrap around the terminal.
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Returns the column IDs.
*
* @return list<string>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Feb 4 2026, 8:52 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12674970
Default Alt Text
D11328.id27199.diff (2 KB)
Attached To
Mode
D11328: Ensure empty lines do not appear with large widths on last column of PhutilConsoleTable
Attached
Detach File
Event Timeline
Log In to Comment