tbabej / vit

Placeholder to demostrate issue porting for VIT.
0 stars 0 forks source link

[VT-81] VIT cannot handle long commands in shortcuts #81

Open tbabej opened 6 years ago

tbabej commented 6 years ago

Scott Kostyshak on 2014-03-22T22:11:39Z says:

If you put the following shortcut in your .vitrc and execute it in VIT (by pressing 'Z') it will not work correctly.

{code} map Z=:!rw echo "this is a long command that fails (at least on my machine) because of a limit on the number of characters you can ungetch before you need to getch" {code}

The reason: VIT relies on a trick to implement shortcuts. It uses ungetch to preload the shortcut and then run it. It works well in the sense that the shortcut should work exactly as if you had typed in each letter. This will also be useful for testing. However, it appears there is a limit to the number of characters you can ungetch before you need to getch.

The good news is that this limit is easily detected by checking the return code of ungetch.

TODO: (1) For VIT 1.2, I'm going to have VIT throw an error and exit. The error will point to this bug. (2) I would like to see if this limit can be increased (without danger). (3) If (2) doesn't work out, I have an idea for a fix. This would involve detecting the limit, say n, pushing the first n characters of the shortcut and setting a flag. Then after getch is done it will see the flag and give control back to ungetch which will set n more until the shortcut is finished. When it is done it will unset the flag.

tbabej commented 6 years ago

Migrated metadata:

Created: 2014-03-22T22:11:39Z
Modified: 2014-03-22T22:11:39Z