FedericoBruzzone / tgt

TUI for Telegram written in Rust 🦀
Apache License 2.0
269 stars 5 forks source link

[bug]: unable to use `alt` on iTerm2 (macOS) #46

Closed thdonatello closed 1 month ago

thdonatello commented 1 month ago

Describe the bug

alt key doesn't exist on mac

Reproduction steps

  1. Open app
  2. Try navigation

Expected behavior

I can't use it because alt key doesn't exist on mac. I have tried to use option key but it doesn't have effect. Could you explain how can I change keybindings? I use iTerm and command is used for manage. I have tried change alt to cmd/command/option in ~/.tgt/config/keymap.toml - no effect. What about vi style? )

Logs and screenshots

No response

Method of Installation

Cargo

tgt version

tgt 1.0.0

Operating System (including version and architecture)

MacOS Sonoma 14.5

Terminal and Command Line Interface (CLI) (including versions)

iTerm2 Build 3.5.4

rustc and rustup target (including versions)

No response

FedericoBruzzone commented 1 month ago

There seems to be a problem with crossterm when a key combination involves ctrl+<number>. It has been there forever and does not affect us. So you can't use other keys besides alt (option) in combination with numbers.

For the vim motion follow the next steps:

mkdir ~/.config/tgt
touch ~/.config/tgt/keymap.toml

And then copy the content of vim_keymap into ~/.config/tgt/keymap.toml.

Note that in the prompt the keymaps are currently hardcoded, so to send a message you have to use alt+enter.

thdonatello commented 1 month ago

It's work with ctrl I can't send message because alt+enter (option+enter on mac) works as enter.

FedericoBruzzone commented 1 month ago

Ok, perfect! Does ot works also in combination with a number?

Unfortunately the only way to send messages is alt+enter; it is hardcoded. I press combinations like ctrl+enter, shift+enter, altgr+enter or things like that in the status bar I only see enter. If I press alt+enter I see exactly alt+enter. This is to tell you that if you see ctrl+enter or something I can add it and release a version with this hardcoded key.

In the future we will allow customization :D

thdonatello commented 1 month ago

Found solution here! Thx!