-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make adjusted
scroll
value available in prompt constructor (#60)
* Make adjusted `scroll` value available in prompt constructor * Fix code styling --------- Co-authored-by: jessarcher <jessarcher@users.noreply.github.com>
- Loading branch information
1 parent
f088bde
commit 79bff71
Showing
10 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Laravel\Prompts\Concerns; | ||
|
||
use Laravel\Prompts\Themes\Contracts\Scrolling; | ||
|
||
trait ReducesScrollingToFitTerminal | ||
{ | ||
/** | ||
* Reduce the scroll property to fit the terminal height. | ||
*/ | ||
protected function reduceScrollingToFitTerminal(): void | ||
{ | ||
$reservedLines = ($renderer = $this->getRenderer()) instanceof Scrolling ? $renderer->reservedLines() : 0; | ||
|
||
$this->scroll = min($this->scroll, $this->terminal()->lines() - $reservedLines); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Laravel\Prompts\Themes\Contracts; | ||
|
||
interface Scrolling | ||
{ | ||
/** | ||
* The number of lines to reserve outside of the scrollable area. | ||
*/ | ||
public function reservedLines(): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters