OSDev.org
https://forum.osdev.org/

how does vim distinguish ESC key from the escape sequence ?
https://forum.osdev.org/viewtopic.php?f=13&t=33071
Page 3 of 3

Author:  Brendan [ Thu Aug 30, 2018 7:45 am ]
Post subject:  Re: how does vim distinguish ESC key from the escape sequenc

Hi,

Sik wrote:
I honestly hate how terminals handle keystrokes for anything that isn't a normal character. I get it about old terminals, but how come none of the extensions over time ever fixed this mess? >​:​|


That's easy: it'd be like building a cable car on Mount Everest to make it easy for people to reach the top. Anything that makes the user interface slightly more user-friendly removes the ability for people to brag about mastering one of the worst possible user interfaces ever designed, so it'd ruin the entire point of using VIM in the first place.


Cheers,

Brendan

Author:  Solar [ Thu Aug 30, 2018 8:58 am ]
Post subject:  Re: how does vim distinguish ESC key from the escape sequenc

My, aren't we confrontational today?

Nobody is trying to force you into using Vim, or anything other than your editor (or language, or compiler, or operating system, or interface in general) of choice.

Could you please refrain from calling those who made other choices than you names?

Author:  Sik [ Thu Aug 30, 2018 11:56 am ]
Post subject:  Re: how does vim distinguish ESC key from the escape sequenc

Yeah, my complaint wasn't even about vim (which I don't like but that's another topic), it was about terminal protocols themselves. It makes it a freaking pain to make TUI programs. It's not just the users who get screwed over it, it's also the developers who now have to restrict what they're allowed to do. That's not fun.

Amusingly, my suggestion would have made things easier for vim (as it could just check for CAN instead of doing the timing stuff and hope the stream isn't too laggy to screw that up). One can dream.

Author:  eekee [ Fri Feb 01, 2019 6:25 pm ]
Post subject:  Re: how does vim distinguish ESC key from the escape sequenc

Wow! So much waffle! And this from a guy who's waffled more than anyone else today! :twisted:

The simple answer to the original question is plainly visible if you use any vi in a TTY: it waits to see if there's a character coming immediately after the escape.

I've repeatedly found that delay to be a nuisance, temporarily confusing and alarming me as the editor gets behind my typing, and I curse the day DEC decided to use the escape character in their key sequences. It throws off my train of thought!

As for why it's such a long delay, I can only imagine it's designed to work with 75 baud serial lines, or maybe laggy ssh sessions.

Page 3 of 3 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/