Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terminal overflow and menu size #255

Open
@Renji-FR

Description

I encountered an issue when my menu is bigger than my terminal:

phpclishell.mp4

Is it possible to print the console line number only for the menu?

I know I use stty binary to retrieve my terminal size:

<?php
	namespace Core\Console;
 class Tools
 {
		/**
		 * @return false|array
		 */
		protected static function _getSize()
		{
			$sttyCommand = 'stty size';
			exec($sttyCommand, $outputs, $status);
			if($status === 0 && count($outputs) >= 1)
			{
				if(preg_match('#^(?<rows>[0-9]+) (?<columns>[0-9]+)$#i', $outputs[0], $matches)) {
					return $matches;
				}
			}
			return false;
		}
		/**
		 * @return false|int
		 */
		public static function getRows()
		{
			$consoleSize = static::_getSize();
			return ($consoleSize !== false) ? ($consoleSize['rows']) : (false);
		}
		/**
		 * @return false|int
		 */
		public static function getColumns()
		{
			$consoleSize = static::_getSize();
			return ($consoleSize !== false) ? ($consoleSize['columns']) : (false);
		}
 }

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /