From 71f57389158110488033ef9a27b48958e2a65ad7 Mon Sep 17 00:00:00 2001 From: Divam Date: Thu, 14 Nov 2024 13:47:35 +0900 Subject: [PATCH] On windows show 'Y' in checkbox, instead of 'I' --- lib-tui/GHCup/Brick/Common.hs | 8 ++++++++ lib-tui/GHCup/Brick/Widgets/Menu.hs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib-tui/GHCup/Brick/Common.hs b/lib-tui/GHCup/Brick/Common.hs index db3b54ff..dd30278a 100644 --- a/lib-tui/GHCup/Brick/Common.hs +++ b/lib-tui/GHCup/Brick/Common.hs @@ -27,6 +27,7 @@ module GHCup.Brick.Common ( installedSign, setSign, notInstalledSign, + checkBoxSelectedSign, showKey, showMod, keyToWidget, @@ -179,6 +180,13 @@ notInstalledSign = "X " notInstalledSign = "✗ " #endif +checkBoxSelectedSign :: String +#if IS_WINDOWS +checkBoxSelectedSign = "Y " +#else +checkBoxSelectedSign = "✓ " +#endif + showKey :: Vty.Key -> String showKey (Vty.KChar c) = [c] diff --git a/lib-tui/GHCup/Brick/Widgets/Menu.hs b/lib-tui/GHCup/Brick/Widgets/Menu.hs index 289d2c89..9c5289af 100644 --- a/lib-tui/GHCup/Brick/Widgets/Menu.hs +++ b/lib-tui/GHCup/Brick/Widgets/Menu.hs @@ -228,7 +228,7 @@ createCheckBoxInput = FieldInput False Right "" checkBoxRender checkBoxHandler border w = Brick.txt "[" <+> (Brick.padRight (Brick.Pad 1) $ Brick.padLeft (Brick.Pad 2) w) <+> Brick.txt "]" drawBool b = if b - then border . Brick.withAttr Attributes.installedAttr $ Brick.str Common.installedSign + then border . Brick.withAttr Attributes.installedAttr $ Brick.str Common.checkBoxSelectedSign else border . Brick.withAttr Attributes.notInstalledAttr $ Brick.str Common.notInstalledSign checkBoxRender focus _ help _ check f = (, Nothing) $ let core = f $ drawBool check