Changeset View
Changeset View
Standalone View
Standalone View
src/ref/ArcanistRefView.php
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | final class ArcanistRefView | ||||
} | } | ||||
private function newLines($indent) { | private function newLines($indent) { | ||||
$ref = $this->getRef(); | $ref = $this->getRef(); | ||||
$object_name = $this->getObjectName(); | $object_name = $this->getObjectName(); | ||||
$title = $this->getTitle(); | $title = $this->getTitle(); | ||||
// Our goal here is to work with strings, defaults or not | |||||
if ($title === null) { | |||||
$title = ''; | |||||
} | |||||
if ($object_name !== null) { | if ($object_name !== null) { | ||||
$reserve_width = phutil_utf8_console_strlen($object_name) + 1; | $reserve_width = phutil_utf8_console_strlen($object_name) + 1; | ||||
} else { | } else { | ||||
$reserve_width = 0; | $reserve_width = 0; | ||||
} | } | ||||
if ($indent) { | if ($indent) { | ||||
$indent_text = str_repeat(' ', $indent); | $indent_text = str_repeat(' ', $indent); | ||||
Show All 12 Lines | private function newLines($indent) { | ||||
// output is completely unusable. | // output is completely unusable. | ||||
$usable_width = max($usable_width, 16); | $usable_width = max($usable_width, 16); | ||||
// TODO: This should truncate based on console display width, not | // TODO: This should truncate based on console display width, not | ||||
// glyphs, but there's currently no "setMaximumConsoleCharacterWidth()". | // glyphs, but there's currently no "setMaximumConsoleCharacterWidth()". | ||||
$title = id(new PhutilUTF8StringTruncator()) | $title = id(new PhutilUTF8StringTruncator()) | ||||
->setMaximumGlyphs($usable_width) | ->setMaximumGlyphs($usable_width) | ||||
->truncateString($title); | ->truncateString($title); | ||||
valerio.bozzolan: ↑ here the problematic area - this should not receive null | |||||
if ($object_name !== null) { | if ($object_name !== null) { | ||||
if (strlen($title)) { | if (strlen($title)) { | ||||
$display_text = tsprintf('**%s** %s', $object_name, $title); | $display_text = tsprintf('**%s** %s', $object_name, $title); | ||||
} else { | } else { | ||||
$display_text = tsprintf('**%s**', $object_name); | $display_text = tsprintf('**%s**', $object_name); | ||||
} | } | ||||
} else { | } else { | ||||
Show All 35 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
↑ here the problematic area - this should not receive null