Skip to content
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

feat: Add Windows Platform Support for terminal_width Method in ShellTable Class #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Losses
Copy link

@Losses Losses commented Jun 12, 2024

Description

This pull request introduces support for the Windows platform in the terminal_width method of the ShellTable class. Previously, the method only supported Unix-like systems using tput and stty commands to determine the terminal width. With this update, the method now includes functionality to retrieve the terminal width on Windows systems using the GetConsoleScreenBufferInfo function from the Windows API.

Changes

  1. Conditional Compilation for Windows:

    • Added a conditional check for the Windows platform using flag?(:win32).
    • Included the necessary lib_c library and defined the GetConsoleScreenBufferInfo function.
  2. New Method for Windows Terminal Width:

    • Implemented the get_windows_width method to retrieve the terminal width on Windows systems.
  3. Updated terminal_width Method:

    • Modified the terminal_width method to call get_windows_width when running on Windows.
    • Retained the existing logic for Unix-like systems using tput and stty.

Testing

  • Verified that the terminal width is correctly determined on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant