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
Closed

Terminal width detection isn't done on Windows #3588

kadoban opened this issue Nov 19, 2017 · 4 comments

Comments

@kadoban
Copy link
Collaborator

kadoban 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
Copy link

eye942 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
Copy link
Contributor

mgsloan 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
Copy link
Contributor

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

NeonGraal added a commit to NeonGraal/stack that referenced this issue May 4, 2019
@NeonGraal NeonGraal mentioned this issue May 4, 2019
2 tasks
@snoyberg
Copy link
Contributor

snoyberg commented May 4, 2019

Fixed by #4797

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

No branches or pull requests

5 participants