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

Terminal width detection isn't done on Windows #3588

Closed
kadoban opened this issue Nov 19, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@kadoban
Copy link
Collaborator

commented Nov 19, 2017

The terminal width detection (that is used for pretty-printing log/warning/error output) is not done on Windows.

If anyone is interested in contributing that, it should be fairly trivial for the right person. It should go in windows/System/Terminal.hs and do something similar in function to what is done in unix/System/Terminal.hsc

@eye942

This comment has been minimized.

Copy link

commented May 31, 2018

@kadoban
Hi, is anyone working on this?

I would like to work on it and have a few ideas on where to start.

I'm pretty sure I understand unix/System/Terminal.hsc, but Windows doesn't seem to have that sort of convenience.

However, there are a couple ways that I think it can be implemented by increasing order of difficulty:

  1. A Haskell Package called Win32. Haskell Platform says that it's a core package. This would be very simple, just an import and returning a simple function call.
  2. Calling Powershell to use the command (Get-Host).UI.RawUI.WindowSize.Width and parsing the result, which is just an integer.
  3. Calling mode and parsing the results, which is a pretty-printed table.
  4. Using FFI to mess with the Windows API. This is not trivial.

Sincerely,
Eric

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jun 11, 2018

@eye942 Approach (1) seems good to me. I don't think anyone is working on this, feel free to have at it

@ndmitchell

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2018

I recommend the terminal-size library which does this in a cross platform manner. It's used in ghcid with much success.

@NeonGraal NeonGraal referenced this issue Apr 28, 2019

Closed

Implement getTerminalWidth for Windows #4779

2 of 2 tasks complete

NeonGraal added a commit to NeonGraal/stack that referenced this issue May 4, 2019

@NeonGraal NeonGraal referenced this issue May 4, 2019

Merged

Win terminal size #4797

2 of 2 tasks complete
@snoyberg

This comment has been minimized.

Copy link
Contributor

commented May 4, 2019

Fixed by #4797

@snoyberg snoyberg closed this May 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.