Skip to content
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

ghcup tui shows docs on ctrl-c #875

Open
alanz opened this issue Aug 26, 2023 · 8 comments
Open

ghcup tui shows docs on ctrl-c #875

alanz opened this issue Aug 26, 2023 · 8 comments

Comments

@alanz
Copy link

alanz commented Aug 26, 2023

When I am in ghcup tui, I instinctively hit ctrl-c to quit.

And I am always surprised to be taken to a web browser opened to the docs of whatever my cursor is on at the time.

The legend at the bottom does not mention this possibility, perhaps it should, bound to something sane like d

@hasufell
Copy link
Member

Changing the key mapping will break lots of users workflows. You can change it yourself:

KChar: 'c'

We could also detect control keys and not trigger any of the actions if they are in combination with such.

@alanz
Copy link
Author

alanz commented Aug 26, 2023

Ah, so it is looking for the key, regardless of modifiers. Can you make it ignore them if ctrl is pressed at the same time.

Going to the changelog is great, I just have a problem with <ctrl-c> doing it.

@hasufell
Copy link
Member

The code is here:

eventHandler :: BrickState -> BrickEvent String e -> EventM String BrickState ()

PRs welcome.

@hasufell
Copy link
Member

The code is here:

eventHandler :: BrickState -> BrickEvent String e -> EventM String BrickState ()

PRs welcome.

Basically, we're ignoring the modifier: https://hackage.haskell.org/package/vty-5.38/docs/Graphics-Vty-Input-Events.html#t:Event

(VtyEvent (Vty.EvKey key _)) ->
case find (\(key', _, _) -> key' == key) (keyHandlers kb) of
Nothing -> put st
Just (_, _, handler) -> handler st

Should be something like

    (VtyEvent (Vty.EvKey key [])) ->
      case find (\(key', _, _) -> key' == key) (keyHandlers kb) of
        Nothing -> put st
        Just (_, _, handler) -> handler st

@alanz
Copy link
Author

alanz commented Aug 27, 2023

I decided I could live with it when I got

[15 of 15] Compiling Codec.Archive    ( src/Codec/Archive.hs, dist/build/Codec/Archive.o, dist/build/Codec/Archive.dyn_o )

c/archive_random.c:54:13: error:
     error: static declaration of ‘arc4random_buf’ follows non-static declaration
       54 | static void arc4random_buf(void *, size_t);
          |             ^~~~~~~~~~~~~~
   |
54 | static void arc4random_buf(void *, size_t);
   |             ^

In file included from c/archive_random.c:30:0: error: 

/usr/include/stdlib.h:542:13: error:
     note: previous declaration of ‘arc4random_buf’ with type ‘void(void *, size_t)’ {aka ‘void(void *, long unsigned int)’}
      542 | extern void arc4random_buf (void *__buf, size_t __size)
          |             ^~~~~~~~~~~~~~
    |
542 | extern void arc4random_buf (void *__buf, size_t __size)
    |             ^
`gcc' failed in phase `C Compiler'. (Exit code: 1)
Error: cabal: Failed to build libarchive-3.0.3.2 (which is required by
exe:ghcup from ghcup-0.1.19.5). See the build log above for details.

having installed the deps from

sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip

@hasufell
Copy link
Member

See vmchale/libarchive#32

@hasufell
Copy link
Member

This unfortunately regressed:

inner_event@(VtyEvent (Vty.EvKey key _)) ->
case find (\(key', _, _) -> key' == KeyCombination key []) (keyHandlers kb) of

@lsmor

@hasufell hasufell reopened this Mar 14, 2024
@lsmor
Copy link
Collaborator

lsmor commented Mar 14, 2024

I am reviewing it

lsmor added a commit to lsmor/ghcup-hs that referenced this issue Mar 17, 2024
lsmor added a commit to lsmor/ghcup-hs that referenced this issue Apr 11, 2024
lsmor added a commit to lsmor/ghcup-hs that referenced this issue Apr 27, 2024
lsmor added a commit to lsmor/ghcup-hs that referenced this issue Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants