[GHC] #10956: Allow default keyboard behavior to be easily overriden
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: | Owner: BalinKingOfMoria | Type: feature | Status: new request | Priority: normal | Milestone: Component: Runtime | Version: 7.8.3 System | Keywords: io input raw | Operating System: Windows Architecture: x86_64 | Type of failure: Incorrect result (amd64) | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If I press the up or down arrow keys, GHC kicks in and makes it so that the last line of text comes back instead of letting me intercept the arrow key. From what I have seen, you need third-party libraries to override the default behavior, but when would a user actually want that behavior in an application instead of letting the programmer handle it? Can there be a switch (like a special LANGUAGE pragma or whatever) to enable raw input capture? Console text editing applications are greatly hindered by this automatic behavior. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): Do you mean... in GHCi? GHCi uses readline, which is why you see this behavior. If you just have a normal GHC compiled program, you get raw input capture. (Of course, actually programming this correctly is quite involved, which is why people use libraries like ncurses in this case.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Since this is on Windows, I wouldn't put it past the console to do this whenever the terminal is in cooked mode (or Windows equivalent). Maybe you just want `hSetBuffering stdin NoBuffering`? That would put the terminal in raw mode on non-Windows systems, but apparently it doesn't work on Windows, see #2189. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by BalinKingOfMoria): Replying to [comment:1 ezyang]:
Do you mean... in GHCi? GHCi uses readline, which is why you see this behavior. If you just have a normal GHC compiled program, you get raw input capture. (Of course, actually programming this correctly is quite involved, which is why people use libraries like ncurses in this case.) No, it's GHC (I already tried); "ghc editor.hs" would do it, right?
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Can you describe the sequence of steps necessary to reproduce? Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden
-------------------------------------+-------------------------------------
Reporter: BalinKingOfMoria | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.8.3
Resolution: | Keywords: io input raw
Operating System: Windows | Architecture: x86_64
Type of failure: Incorrect result | (amd64)
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by BalinKingOfMoria):
Replying to [comment:4 goldfire]:
> Can you describe the sequence of steps necessary to reproduce? Thanks!
1. Setup prompt at Windows console (infinite recursion with getLine will
do it)
2. Type something into the prompt and hit Enter
3. Press the up arrow and watch the text you entered last come back.
--
Ticket URL:
GHC
The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): You skipped some steps in step 1. I *think* what you mean is: 1a. Create this file `uptest.hs` {{{ import Control.Monad main = forever getLine }}} 1b. Compile with `ghc uptest` 1c. Run `./uptest` (or whatever Windows equivalent) but I'm not sure especially about 1b and 1c, so please correct me if this is wrong! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
#10956: Allow default keyboard behavior to be easily overriden -------------------------------------+------------------------------------- Reporter: BalinKingOfMoria | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.8.3 Resolution: | Keywords: io input raw Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by BalinKingOfMoria): Sorry for the confusion... I just used getLine as an example of the function to get input. The program (test.hs) would look something like this {{{ main = do getLine main }}} I'd then run "ghc test.hs" at the command line and "test" to run the program. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10956#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC