meow-edit / meow

Yet another modal editing on Emacs / 猫态编辑
GNU General Public License v3.0
1.07k stars 128 forks source link

Missing Commentary on meow-esc.el in Docstring #510

Closed jgarte closed 7 months ago

jgarte commented 7 months ago

https://github.com/meow-edit/meow/blob/master/meow-esc.el#L16

Could we add a comment there?

I'm not sure what to put.

DogLooksGood commented 7 months ago

These codes are copied from evil to make esc work in terminal. :)

jgarte commented 7 months ago

What should we write for the module docstring short explanation?

DogLooksGood commented 7 months ago

This module is used to patch the behavior of ESC key in terminal.

jgarte commented 7 months ago

Why was the patching required?

Just curious to understand the historical reason for it needing to exist.

eshrh commented 7 months ago

It's because meta combos in the terminal send the exact same keycode as pressing ESC and then the key, which is why you can use ESC as meta in the terminal. This is problematic for evil and meow because esc is used while coding more frequently, if you press escape and then a key usually you don't want the meta combo. meow-esc-delay is the maximum time between ESC and the keypress that should be treated as a meta combo. If the time is longer than the delay, it's treated as pressing ESC and then the key separately