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

Key bindings in custom commands are all mapped to lower cases #3470

Open
fenguoerbian opened this issue Apr 3, 2024 · 6 comments
Open

Key bindings in custom commands are all mapped to lower cases #3470

fenguoerbian opened this issue Apr 3, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@fenguoerbian
Copy link

Describe the bug
In my config.yaml I've set two custom commands to push and pull to specific remotes and branches. This part of the config is shown as below

customCommands:
  - key: '<c-p>'
    description: "Pull from a specific remote repository"
    context: 'files'
    loadingText: 'Pulling ...'
    command: git pull {{ .Form.Remote }} {{ .Form.RemoteBranch }}
    prompts:
      - type: 'input'
        key: 'Remote'
        title: "Remote:"
        suggestions:
          preset: 'remotes'
      - type: 'input'
        key: 'RemoteBranch'
        title: "Remote branch:"
        suggestions:
          command: "git branch --remote --list '{{.Form.Remote}}/*' --format='%(refname:short)' | sed 's/{{.Form.Remote}}\\///'"
  - key: '<c-P>' # '<c-P>' will not work?, seems to be same as '<c-p>', please use '?' in file panel to bring up the keybindings menu
    description: "Push to a specific remote repository"
    context: 'files'
    loadingText: 'Pus hing ...'
    command: git push {{ .Form.Remote }} {{ .Form.RemoteBranch }}
    prompts:
      - type: 'input'
        key: 'Remote'
        title: "Remote:"
        suggestions:
          preset: 'remotes'
      - type: 'input'
        key: 'RemoteBranch'
        title: "Remote branch:"
        suggestions:
          command: "git branch --remote --list '{{.Form.Remote}}/*' --format='%(refname:short)' | sed 's/{{.Form.Remote}}\\///'"          

The key bindings for these two commands are <c-p> and <c-P>. But in actuality they are all mapped to <c-p> in lazygit, see the screenshot below:

lazygit_keybinding_problems

To Reproduce
As described in the bug description

Expected behavior
I'm not sure whether the custom command keybindings support the capital letter or am I just missing some config settings to setup a keybinding with capital letter.

Version info:
lazygit version:
commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=windows, arch=amd64, git version=2.43.0.windows.1

git version:
git version 2.43.0.windows.1

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

@fenguoerbian fenguoerbian added the bug Something isn't working label Apr 3, 2024
@dsolerh
Copy link

dsolerh commented Apr 9, 2024

hi, I'll like to give this one a try. Can someone assign me?

@mark2185
Copy link
Collaborator

mark2185 commented Apr 9, 2024

@dsolerh feel free to take it, do note that I'm not sure if this is just a bug that we map everything as lowercase, or if we can't actually detect <c-p> vs <c-shift-p>.

@dsolerh
Copy link

dsolerh commented Apr 9, 2024

yes, I think the clear way to implement it will be using <c-shift-something>
in that case we'll have to add all those keys to the map, and I guess that check how they are converted to actual key press

@dsolerh
Copy link

dsolerh commented Apr 9, 2024

Hi, I can't find a way to capture an key event when I press ctr+shift+, I. think that the tcell package does not support this:
image
https://pkg.go.dev/github.com/gdamore/tcell/[email protected]#ModShift

@mark2185
Copy link
Collaborator

mark2185 commented Apr 9, 2024

@stefanhaller you've been elbow-deep in the tcell, you could probably answer this off the cuff.

@stefanhaller
Copy link
Collaborator

I'm not an expert here either, but my suspicion is that it's just not possible unless tcell implements gdamore/tcell#671.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants