-
Notifications
You must be signed in to change notification settings - Fork 106
Dialogue feature #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialogue feature #49
Conversation
Current coverage is 84.96% (diff: 95.10%)@@ develop #49 diff @@
==========================================
Files 15 19 +4
Lines 614 745 +131
Methods 166 183 +17
Messages 0 0
Branches 0 0
==========================================
+ Hits 509 633 +124
- Misses 105 112 +7
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving this feature ❤️
} | ||
|
||
$style = (new MenuStyle($this->terminal)) | ||
->setBg('yellow') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make this customizable (one for a minor release later though imo, unless it would be a BC break)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can grab the style from the Flash object and change it before you call display
:). Checkout the example 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course ... that didn't click .. nice!
$this->style->getUnselectedSetCode() | ||
)); | ||
|
||
$this->write( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be handling long messages, e.g. wrap over multiple lines like we do with the menu items?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ATM - we only allow one line message and long message won't wrap - it was a bit hard for the calculating logic as I was rushing. We can add this in the future with a bit more time without breaking BC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah no worries sounds good to me. it would complicate centering height etc too so a nice little challenge in the future
} | ||
|
||
/** | ||
* @param $row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string ?
@@ -217,6 +217,11 @@ public function moveCursorToRow($rowNumber) | |||
echo sprintf("\033[%d;0H", $rowNumber); | |||
} | |||
|
|||
public function moveCursorToColumn($column) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing doc block
{ | ||
$textLines = count(explode("\n", $this->text)) + 2; | ||
$this->y = ceil(($this->parentMenu->getCurrentFrame()->count() / 2)) - ceil($textLines / 2) + 1; | ||
$this->x = ($this->style->getWidth() / 2) - (mb_strlen($this->text) / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think you need to divide the text length by 2 here dude
TODO: