nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Implement macro recording and playback


From: Benno Schulenberg
Subject: Re: [Nano-devel] Implement macro recording and playback
Date: Sun, 8 Oct 2017 12:17:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0


Hello Marco,

Op  8-10-2017 om 03:10 schreef Marco Diego Aurélio Mesquita:
Since there is interest in macro recording and playback, I tried to see how
complicated it would be to implement it.

The attached patch implements it for keys <Down>, <End>, <Left> and <Backspace> only.

:)  That's funny.

The current implementation is intended only to start a discussion about what
is the right way to implement it

Your approach... is entirely the wrong direction.

What should be done is this: when macro recording is switched on,
then in get_key_buffer() each keystroke, as it comes in, is copied
to a second key buffer, the macro_buffer (growing dynamically as
needed, just like the normal key_buffer).  When the runmacro key
is pressed, all that nano needs to do is: copy the macro_buffer
into the key_buffer, copy macro_length to key_buffer_len, and let
the normal interpretation machinery do the rest.

Once we decided what is the minimum acceptable implementation, I think that
all that would be needed then is a list of functions that should be
macro-record-able.

*All* functions should be recordable.  But that will not be a problem
when you simply record keystrokes.

Benno, do you agree with my changes and variable/constant names?

Call the function that starts/stops recording of a macro record_macro(),
and the function that "runs" the macro (copies the macro_buffer into the
key_buffer) run_macro().  There is no maximum macro length.  Call the
'rec_macro' boolean simply 'recording'.  And use 'macro_length' instead
of 'macro_pos'.

Benno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]