-
Notifications
You must be signed in to change notification settings - Fork 81
Fix #130 Don't skip "\ESC...\STX" sequences (when terminal-style) #126
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
Conversation
b564d7a to
3b26f1e
Compare
|
I have taken a different approach to my original pull request. I use the same logic as in the It has been tested on Windows 11, with the same example code as above. As in the case of |
|
Status update: @athas has expressed willingness to consider this once it is updated and a windows user has vouched for it. |
For ANSI-capable terminals, this reverses commit f827f10 of 11 September 2010 (about 5 years before the November 2015 Update to Windows 10 made the native consoles on Windows 10 ANSI-capable). It uses the same logic as the ansi-terminal package to determine if the terminal is ANSI-capable.
|
To start with, I have:
As in 2022, I don't have access to legacy Windows machines to test. However:
|
|
Does that mean you suggest we revert f827f10 instead of merging this PR? I have no opinion on or knowledge of the terminal situation on Windows, so I am willing to go with whatever you consider best. |
|
@athas, in short 'yes'. I think the situation for Windows users (of which I am one) is this:
(I think the problem with my 20 August 2022 patch is that I was not enabling ANSI early enough.) I think:
EDIT: If there is an interest in the last bullet point above, I have an alternative pull request that implements it. Users on Windows would have code like: module Main where
import Control.Monad ( when )
import System.Console.Haskeline
main :: IO ()
main = do
runInputT defaultSettings $ do
-- Test needed only if necessary to support users of conhost.exe
isAnsiSupported <- enableAnsiSupport
when isAnsiSupported loop
where
prompt = "\ESC[34m\STXBlue\ESC[39m\STX\n\ESC[31m\STXRed\ESC[39m\STX: "
loop :: InputT IO ()
loop = do
minput <- getInputLine prompt
case minput of
Nothing -> pure ()
Just "quit" -> pure ()
Just input -> do outputStrLn $ "Input was: " ++ input
loop |
|
If you make a PR that reverts that commit, then I will merge it. While I'm reluctant to make opinionated changes to Haskeline, I prefer supporting recent Windows users over ancient Windows users. |
|
@athas, now done. |
|
Could you also update the Changelog? This is after all a user-visible change. |
|
@athas, happy to do that and also done. |


This reverses commit f827f10 of 11 September 2010 (about 5 years before the November 2015 Update to Windows 10 made the native consoles on Windows 10 ANSI-capable). Applications like
GHCiandstackenable the ANSI-capability of the native consoles.In respect of legacy Windows, none of them have mainstream support by Microsoft and Windows 7 loses extended support on 14 January 2020.
It has been tested on Windows 10 with