trait Scrolling

Properties

int $scroll

The number of items to display before scrolling.

int|null $highlighted

The index of the highlighted option.

int $firstVisible

The index of the first visible option.

Methods

void
initializeScrolling(int|null $highlighted = null)

Initialize scrolling.

void
reduceScrollingToFitTerminal()

Reduce the scroll property to fit the terminal height.

void
highlight(int|null $index)

Highlight the given index.

void
highlightPrevious(int $total, bool $allowNull = false)

Highlight the previous entry, or wrap around to the last entry.

void
highlightNext(int $total, bool $allowNull = false)

Highlight the next entry, or wrap around to the first entry.

void
scrollToHighlighted(int $total)

Center the highlighted option.

Details

at line 29
protected void initializeScrolling(int|null $highlighted = null)

Initialize scrolling.

Parameters

int|null $highlighted

Return Value

void

at line 39
protected void reduceScrollingToFitTerminal()

Reduce the scroll property to fit the terminal height.

Return Value

void

at line 49
protected void highlight(int|null $index)

Highlight the given index.

Parameters

int|null $index

Return Value

void

at line 67
protected void highlightPrevious(int $total, bool $allowNull = false)

Highlight the previous entry, or wrap around to the last entry.

Parameters

int $total
bool $allowNull

Return Value

void

at line 85
protected void highlightNext(int $total, bool $allowNull = false)

Highlight the next entry, or wrap around to the first entry.

Parameters

int $total
bool $allowNull

Return Value

void

at line 101
protected void scrollToHighlighted(int $total)

Center the highlighted option.

Parameters

int $total

Return Value

void