php-school / cli-menu

🖥 Build beautiful PHP CLI menus. Simple yet Powerful. Expressive DSL.
http://www.phpschool.io
MIT License
1.94k stars 106 forks source link

Auto resize width #222

Closed AydinHassan closed 4 years ago

AydinHassan commented 4 years ago

An attempt at resizing the menu when the terminal is resized. It seems to be a bit jittery, some resizes work, some do not.

It works when first being resized, storing the width of the menu. Every time it is resized, we will attempt to set the original width, which will either shrink the menu if the terminal is too small to display it, or if the terminal is enlarged, it will attempt to display the menu at its original width.

Needs https://github.com/php-school/terminal/pull/12

And is based on top off #220 so can be rebased when that is merged to reduce the diff.

codecov-io commented 4 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@0283b18). Click here to learn what that means. The diff coverage is 10.52%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #222   +/-   ##
=========================================
  Coverage          ?   58.63%           
  Complexity        ?      611           
=========================================
  Files             ?       31           
  Lines             ?     1830           
  Branches          ?        0           
=========================================
  Hits              ?     1073           
  Misses            ?      757           
  Partials          ?        0
Impacted Files Coverage Δ Complexity Δ
src/CliMenu.php 2.59% <0%> (ø) 117 <0> (?)
src/Terminal/TerminalFactory.php 100% <100%> (ø) 1 <0> (?)
src/MenuStyle.php 92.28% <9.09%> (ø) 79 <3> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0283b18...a96cffe. Read the comment docs.