cloudhead / rx

👾 Modern and minimalist pixel editor
https://discord.gg/xHggPjfsS9
GNU General Public License v3.0
3.09k stars 109 forks source link

Can't go into command mode due to the way input is received #83

Closed luciusmagn closed 4 years ago

luciusmagn commented 4 years ago

In my country's layout (and US english too I think) I write colon by shift-. but rx doesn't register it as a colon, but by pressing and releasing shift and period, so I can't enter command mode :(

output from verbose logging
DEBUG [rx::session] command: BrushUnset(Multi)
DEBUG [rx] event: KeyboardInput(KeyboardInput { state: Pressed, key: Some(Shift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, meta: false } })
DEBUG [rx::session] command: BrushSet(Multi)
DEBUG [rx] event: KeyboardInput(KeyboardInput { state: Pressed, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
DEBUG [rx] event: ReceivedCharacter(':')

(it says received character :, but it's not switching to command mode)

luciusmagn commented 4 years ago

whoops, I think this is a duplicate of #23

cloudhead commented 4 years ago

Yeah this does seem like a duplicate. Have you re-mapped it to a different key in the meantime?

In the US layout, colon is <shift> ;, so it works fine.

I'm wondering what the correct way to handle this is, that would work without any extra config, across all layouts. I guess I could special-case command-mode so that receiving the : character would be enough. As I explained in #23, I can't use "received characters" for everything, but perhaps for this one case it could work.

luciusmagn commented 4 years ago

Yea, on my layout (Czech) it's shift-. (:) and shift-, (?), so I added keybindings for that. I found that I can't really do keykombos in init.rx, so I remapped it in the source and made a pull request people can see if they run into the same issue #86 (it's not really intended for merging I'd say, just so it's visible yea).

luciusmagn commented 4 years ago

Hmm, maybe allowing the map command to have a literal mode (i. e. ReceivedCharacters) might be a solution. I read #23 so I get that the lack of release events is a game breaker, but maybe this might work? I haven't looked into the way input is handled in rx yet, so I don't know how cumbersome it would be, but I'll look into it and if it seems not too bad, I might try implementing it to see if it feels right

cloudhead commented 4 years ago

Hmm, maybe allowing the map command to have a literal mode (i. e. ReceivedCharacters) might be a solution.

Yeah I think that's an interesting solution. It could just require you to quote the key, eg.

map ':' :mode command

I'm gonna play around with this.

cloudhead commented 4 years ago

Try the above PR?

luciusmagn commented 4 years ago

Will do, moment

luciusmagn commented 4 years ago

@cloudhead works like a charm, thanks!