MultiSearchPromptRenderer
class MultiSearchPromptRenderer extends Renderer implements Scrolling
Traits
Properties
| protected string | $output | The output to be rendered. |
from Renderer |
| protected int | $minWidth | from DrawsBoxes |
Methods
Multi-byte version of wordwrap.
Word wrap text while preserving ANSI escape sequences.
Truncate visible ANSI text without cutting a control sequence.
Parse text into segments with their associated ANSI codes.
Update the bounded set of active SGR attributes.
Create a new renderer instance.
Get the renderer-owned formatter without changing application output settings.
Format an independent value using the configured console styles.
Get the visible text used to measure a formatted value.
Truncate a formatted value without cutting its markup or terminal controls.
Apply the callback if the given "value" is truthy.
Get the length of the longest line.
Pad text ignoring ANSI escape sequences.
Replace the last visible grapheme while preserving trailing formatting.
Strip ANSI escape sequences from the given text.
Draw a box.
Render a scrollbar beside the visible items.
Return the position where the scrollbar "handle" should be rendered.
Render the value with the cursor and a search icon.
Render a spacer to prevent jumping when the suggestions are displayed.
The number of lines to reserve outside of the scrollable area.
Details
in
Colors at line 12
string
reset(string $text)
Reset all colors and styles.
in
Colors at line 20
string
bold(string $text)
Make the text bold.
in
Colors at line 28
string
dim(string $text)
Make the text dim.
in
Colors at line 36
string
italic(string $text)
Make the text italic.
in
Colors at line 44
string
underline(string $text)
Underline the text.
in
Colors at line 52
string
inverse(string $text)
Invert the text and background colors.
in
Colors at line 60
string
hidden(string $text)
Hide the text.
in
Colors at line 68
string
strikethrough(string $text)
Strike through the text.
in
Colors at line 76
string
black(string $text)
Set the text color to black.
in
Colors at line 84
string
red(string $text)
Set the text color to red.
in
Colors at line 92
string
green(string $text)
Set the text color to green.
in
Colors at line 100
string
yellow(string $text)
Set the text color to yellow.
in
Colors at line 108
string
blue(string $text)
Set the text color to blue.
in
Colors at line 116
string
magenta(string $text)
Set the text color to magenta.
in
Colors at line 124
string
cyan(string $text)
Set the text color to cyan.
in
Colors at line 132
string
white(string $text)
Set the text color to white.
in
Colors at line 140
string
bgBlack(string $text)
Set the text background to black.
in
Colors at line 148
string
bgRed(string $text)
Set the text background to red.
in
Colors at line 156
string
bgGreen(string $text)
Set the text background to green.
in
Colors at line 164
string
bgYellow(string $text)
Set the text background to yellow.
in
Colors at line 172
string
bgBlue(string $text)
Set the text background to blue.
in
Colors at line 180
string
bgMagenta(string $text)
Set the text background to magenta.
in
Colors at line 188
string
bgCyan(string $text)
Set the text background to cyan.
in
Colors at line 196
string
bgWhite(string $text)
Set the text background to white.
in
Colors at line 204
string
gray(string $text)
Set the text color to gray.
in
InteractsWithAnsi at line 16
protected string
mbWordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false)
Multi-byte version of wordwrap.
in
InteractsWithAnsi at line 109
protected array
ansiWordwrap(string $text, int $width, bool $cutLongWords = false)
Word wrap text while preserving ANSI escape sequences.
in
InteractsWithAnsi at line 134
protected string
truncateAnsi(string $text, int $width)
Truncate visible ANSI text without cutting a control sequence.
in
InteractsWithAnsi at line 246
protected array
parseAnsiText(string $text)
Parse text into segments with their associated ANSI codes.
in
InteractsWithAnsi at line 358
protected void
updateSgrState(array $activeSgr, string $escape)
Update the bounded set of active SGR attributes.
in
Renderer at line 30
__construct(Prompt $prompt, OutputFormatterInterface|null $formatter = null)
Create a new renderer instance.
in
Renderer at line 37
protected OutputFormatterInterface
formatter()
Get the renderer-owned formatter without changing application output settings.
in
Renderer at line 52
protected string
formatText(string $text, bool $decorated = true)
Format an independent value using the configured console styles.
in
Renderer at line 67
protected string
visibleText(string $text)
Get the visible text used to measure a formatted value.
in
Renderer at line 75
protected string
truncate(string $string, int $width)
Truncate a formatted value without cutting its markup or terminal controls.
in
Renderer at line 143
protected Renderer
when(mixed $value, callable $callback, callable|null $default = null)
Apply the callback if the given "value" is truthy.
in
Renderer at line 157
string
__toString()
Render the output with a blank line above and below.
in
InteractsWithStrings at line 19
protected int
longest(array $lines, int $padding = 0)
Get the length of the longest line.
in
InteractsWithStrings at line 30
protected string
pad(string $text, int $length, string $char = ' ')
Pad text ignoring ANSI escape sequences.
in
InteractsWithStrings at line 40
protected string
replaceLastVisibleGrapheme(string $line, string $replacement)
Replace the last visible grapheme while preserving trailing formatting.
in
InteractsWithStrings at line 71
protected string
stripEscapeSequences(string $text)
Strip ANSI escape sequences from the given text.
in
DrawsBoxes at line 20
protected DrawsBoxes
box(string $title, string $body, string $footer = '', string $color = 'gray', string $info = '')
Draw a box.
in
DrawsScrollbars at line 21
protected array|Collection
scrollbar(array|Collection $visible, int $firstVisible, int $height, int $total, int $width, string $color = 'cyan')
Render a scrollbar beside the visible items.
in
DrawsScrollbars at line 42
protected int
scrollPosition(int $firstVisible, int $height, int $total)
Return the position where the scrollbar "handle" should be rendered.
at line 18
string
__invoke(MultiSearchPrompt $prompt)
Render the multisearch prompt.
at line 76
protected string
valueWithCursorAndSearchIcon(MultiSearchPrompt $prompt, int $maxWidth)
Render the value with the cursor and a search icon.
at line 88
protected MultiSearchPromptRenderer
spaceForDropdown(MultiSearchPrompt $prompt)
Render a spacer to prevent jumping when the suggestions are displayed.
at line 109
protected string
renderOptions(MultiSearchPrompt $prompt)
Render the options.
at line 142
protected string
renderSelectedOptions(MultiSearchPrompt $prompt)
Render the selected options.
at line 157
protected string
getInfoText(MultiSearchPrompt $prompt)
Render the info text.
at line 179
int
reservedLines()
The number of lines to reserve outside of the scrollable area.