Skip to content

Commit cba3fc5

Browse files
RyanGlScottMistuke
authored andcommitted
Docs: Clarify that isMinTTY only checks for old MinTTYs
Despite the name, `isMinTTY` is only capable of detecting the presence of old versions of MinTTY. The name of the function is perhaps misleading in that regard, but it is widely used enough at this point to where renaming it would be disruptive. Instead, let's just clarify its intent in the documentation. Resolves #216.
1 parent efab7f1 commit cba3fc5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

System/Win32/MinTTY.hsc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
-- Stability : provisional
1616
-- Portability : portable
1717
--
18-
-- A function to check if the current terminal uses MinTTY.
18+
-- A function to check if the current terminal uses an old version of MinTTY
19+
-- that emulates a TTY. Note, however, that this does not check for more recent
20+
-- versions of MinTTY that use the native Windows console PTY directly. The old
21+
-- approach (where MinTTY emulates a TTY) sometimes requires different
22+
-- approaches to handling keyboard inputs.
23+
--
1924
-- Much of this code was originally authored by Phil Ruffwind and the
2025
-- git-for-windows project.
2126
--
@@ -50,8 +55,9 @@ import Foreign.C.Types
5055
#include <windows.h>
5156
#include "winternl_compat.h"
5257

53-
-- | Returns 'True' if the current process's standard error is attached to a
54-
-- MinTTY console (e.g., Cygwin or MSYS). Returns 'False' otherwise.
58+
-- | Returns 'True' if the current process's standard error is attached to an
59+
-- emulated MinTTY console (e.g., Cygwin or MSYS that use an old version of
60+
-- MinTTY). Returns 'False' otherwise.
5561
isMinTTY :: IO Bool
5662
isMinTTY = do
5763
h <- getStdHandle sTD_ERROR_HANDLE
@@ -61,8 +67,9 @@ isMinTTY = do
6167
then return False
6268
else isMinTTYHandle h
6369

64-
-- | Returns 'True' is the given handle is attached to a MinTTY console
65-
-- (e.g., Cygwin or MSYS). Returns 'False' otherwise.
70+
-- | Returns 'True' is the given handle is attached to an emulated MinTTY
71+
-- console (e.g., Cygwin or MSYS that use an old version of MinTTY). Returns
72+
-- 'False' otherwise.
6673
isMinTTYHandle :: HANDLE -> IO Bool
6774
isMinTTYHandle h = do
6875
fileType <- getFileType h

0 commit comments

Comments
 (0)