[TxMt] Re: Emulating keyboard activity with commands
Timothy Bates
timothy.c.bates at gmail.com
Tue Oct 2 23:56:04 UTC 2012
Hi Steven,
Backspace doesn't delete unselected characters: so if you select a line, and press backspace, you merely end up with a carat at character 0 on the line.
If the \n preceding a line is in the selection, then a command setting the selection to "" will erase the newline.
Macro recording will be great when it comes (I'm actually waiting till TMs internal states like dynamic selections can be played with in bundle commands and snippets).
But if we can't code, then at least while we wait these kinds of example can be worked around pretty easily.
If the example really is simply "do what backspace does when a line and the preceeding feed are selected", then that comes built-in and bound to backspace :-)
cheers,
tim
On 3 Oct 2012, at 00:43, Steven Arnold <thoth_amon at mac.com> wrote:
> Let me try to sharpen the point of my last question in a way that will make macros mostly unnecessary for me. I'd like to be able to emulate keyboard activity using commands.
>
> One simple example is hitting backspace. To delete the current line, I can take the current line as input and replace it with "". But, this merely deletes the content of the current line; it does not remove the entire line (the carriage return is still there).
>
> I've tried things like:
>
> print "\x08"
> print "\b"
>
> These give the literal text "<BS>" instead of actually acting as if I had hit the backspace key.
>
> This is only one example. I might want to emulate other "meta" keypresses too. Even though the paste problem is solved with `pbpaste`, command-V would have worked too. It would be nice to have the option of emulating those kinds of keypresses.
>
> What's the best way to handle this kind of problem?
>
> Thanks again for any information!
> steven
More information about the textmate
mailing list