[prev in list] [next in list] [prev in thread] [next in thread]
List: darcs-devel
Subject: [darcs-devel] [patch1113] resolve issue2332: ignore case of characters in prompt
From: Guillaume Hoffmann <bugs () darcs ! net>
Date: 2014-01-28 20:50:22
Message-ID: 52e81804.94658c0a.31f2.ffff9251 () mx ! google ! com
[Download RAW message or body]
New submission from Guillaume Hoffmann <guillaumh@gmail.com>:
I've checked the SelectChanges module, there is no ambiguity
in ignoring casse of characters in prompt.
1 patch for repository http://darcs.net:
Tue Jan 28 17:16:57 ART 2014 Guillaume Hoffmann <guillaumh@gmail.com>
* resolve issue2332: ignore case of characters in prompt
----------
files: patch-preview.txt, resolve-issue2332_-ignore-case-of-characters-in-p=
rompt.dpatch, unnamed
messages: 17149
nosy: gh
status: needs-screening
title: resolve issue2332: ignore case of characters in prompt
__________________________________
Darcs bug tracker <bugs@darcs.net>
<http://bugs.darcs.net/patch1113>
__________________________________
["patch-preview.txt" (text/x-darcs-patch)]
[resolve issue2332: ignore case of characters in prompt
Guillaume Hoffmann <guillaumh@gmail.com>**20140128201657
Ignore-this: 1b6d417b5d707a95d2d6e6dc6aff7a4b
] hunk ./src/Darcs/Util/Prompt.hs 17
import Control.Monad ( void )
-import Data.Char ( toUpper, isSpace )
+import Data.Char ( toUpper, toLower, isSpace )
import System.Console.Haskeline ( runInputT, defaultSettings, getInputLine,
getInputChar, outputStr, outputStrLn )
hunk ./src/Darcs/Util/Prompt.hs 74
promptYorn p = (== 'y') `fmap` promptChar (PromptConfig p "yn" [] Nothing [])
+-- | Prompt the user for a character, among a list of possible ones.
+-- Always returns a lowercase character. This is because the default
+-- character (ie, the character shown in uppercase, that is automatically
+-- selected when the user presses the space bar) is shown as uppercase,
+-- hence users may want to enter it as uppercase.
promptChar :: PromptConfig -> IO Char
promptChar (PromptConfig p basic_chs adv_chs md help_chs) =
withoutProgress $ runInputT defaultSettings loopChar
hunk ./src/Darcs/Util/Prompt.hs 87
loopChar = do
let chars = setDefault (basic_chs ++ (if null adv_chs then "" else "..."))
prompt = p ++ " [" ++ chars ++ "]" ++ helpStr
- a <- getInputChar prompt >>= maybe (error "promptChar: unexpected end of input")
- return
+ a <- getInputChar prompt >>= maybe (error "promptChar: unexpected end of input") (return . toLower)
case () of
_ | a `elem` chs -> return a
| a == ' ' -> maybe tryAgain return md
["resolve-issue2332_-ignore-case-of-characters-in-prompt.dpatch" (application/x-darcs-patch)]
["unnamed" (application/octet-stream)]
_______________________________________________
darcs-devel mailing list
darcs-devel@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic