-
Notifications
You must be signed in to change notification settings - Fork 77
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
Consider using control sequences in the prompt on Windows too #130
Comments
This change seems reasonable to me. I would like to still be a little cautious about older versions, since GHC (which Haskeline depends on) still claims to support Windows Vista: But maybe we can just use something like CPP to check whether we're on a new enough version of Windows. I found this documentation which suggests that we can enable it explicitly with It looks like GHC (the compiler binary, and ghci) enables that mode itself, but probably not for compiled code: I don't have a version of Windows easily available at the moment, but please feel free to send a PR. |
I was testing within GHCi/ Understood on backwards capability - disabling the existing 'blanket' I think there may be no simple CPP approach to distinguish legacy Windows from Windows 10; when I was looking at 'CPP-type solutions' for the |
it would be nice if this were at least an option I could enable - I have a haskeline app that uses ansi escapes for coloring, and it works fine on windows except for the prompt, which ends up mangled. I'm more than willing to opt-out of backward compatibility here. |
@mokus0 you should follow these instructions for control sequences in the prompt: |
It has been about two and a half years since I proposed pull request #126. It is also about two and half years since Microsoft ceased mainstream support for the last mainstream-supported version of Windows that was not ANSI-capable (Windows 7, service pack 1 on 14 January 2020). Cygwin and, consequently, MSYS2 have announced that they will cease to support Windows Vista by the end of 2022 (Microsoft dropped its mainstream support for Vista on 11 April 2017). Perhaps now is a good time to place more weight on the needs of modern Windows users over those who are still on unsupported legacy versions? |
How about this? https://stackoverflow.com/a/55080889 import System.Win32.Info.Version -- from Win32 package
main :: IO ()
main = do
osVersionInfo <- getVersionEx
print (dwBuildNumber osVersionInfo) |
Thanks @aryairani, that looks like it may be a non-CPP solution. However, I think the underlying question remains: is it sensible for modern versions of |
Maybe, maybe not; but if supporting the old OS is to get the consensus needed to support the new OS (the |
Understood. When I have a moment, I'll revisit #126 accordingly. |
It turns out my optimisim at #130 (comment) was unfounded. The underlying Win32 API OSVERSIONINFOEX {dwMajorVersion = 6, dwMinorVersion = 2, dwBuildNumber = 9200, dwPlatformId = 2, szCSDVersion = "", wServicePackMajor = 0, wServicePackMinor = 0, wSuiteMask = 256, wProductType = VerNTWorkStation} which, as the documentation explains, is the Windows 8 OS version value (6.2). |
Doh, sorry. It looks like the functions we'd want now would be like |
When I have another moment, I'll see if I can add |
Actually, |
I have modified #126 to use the same logic as the |
Checking in, another 2 years plus since the last discussion. Windows users of |
Splitting out a comment from @mpilgrem, originally on #88:
The native consoles on Windows 10 are ANSI-capable, and there is no longer any version of Windows that has mainstream support by Microsoft that is not ANSI-capable, although ANSI-capability needs to be 'turned on' because of backwards compatibility with consoles on legacy Windows. I think GHCi and
stack exec -- [command]
turns it on.A little knowledge is a dangerous thing, but when I disabled
fixEsc
indrawLineDiff
(in moduleSystem.Console.Haskeline.Backend.Win32
) as follows:then
haskeline
worked as expected. I tested it with:The text was updated successfully, but these errors were encountered: