[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] implementing macro recording and playback
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] implementing macro recording and playback |
Date: |
Mon, 9 Oct 2017 21:22:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Op 9-10-2017 om 02:44 schreef Marco Diego Aurélio Mesquita:
I run nano, hit M-: a M-:, then I press and hold M-". Instead of a row
of a', I get a row of a"'s.
Search in winio.c for the string "hex codes". Un-ifdef that piece of
code. Then run nano with 2>TRAIL. Define a macro, and run it a few
times. Then look at the contents of TRAIL. You'll see that both the
defining keystroke and the running keystroke consist of two integers,
two codes, not a single one. The first one is what matters: reducing
the length of what is copied from the macrobuffer to the keybuffer by
just one position is not enough.
Instead of reducing this length when copying one buffer to the other,
immediately when the recording is stopped, reduce the length by one,
and then, if the macrobuffer ends in an Escape (0x1b), reduce its
length by a further position. After that, you can always copy the
full (because now correct) length of the macrobuffer to the keybuffer.
There is one more problem: after doing
just what I described, move the cursor to the middle of the row,hit
M-: <Del> <Del> a a M-:, then when I run the macro, chars are removed
but I only see added chars after I move the cursor
Remove the call of edit_refresh(). It has no business there.
The attached patch should address these points.
Good. Further points: there is no need for a separate function to
copy the macro_buffer into the key_buffer. Integrate it into the
run_macro() function. Precede each function with a comment, a
concise description of what it does. Use the same style as in
other such comments. Rename the function macro_add_key() to
add_to_macrobuffer(int code) -- what is added is an integer, not
a key: a keystroke can produce a short sequence of codes. Instead
of allocating a fresh macro_buffer when the first code is added,
initialize the buffer when the recording starts -- it saves the
assignment and the checking for NULL. Add comments after the
three added variables, just like the ones before them have.
And a boolean is initialized to FALSE, not to zero.
Benno
- [Nano-devel] Implement macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/07
- Re: [Nano-devel] Implement macro recording and playback, Benno Schulenberg, 2017/10/08
- Re: [Nano-devel] Implement macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/08
- Re: [Nano-devel] implementing macro recording and playback, Benno Schulenberg, 2017/10/08
- Re: [Nano-devel] implementing macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/08
- Re: [Nano-devel] implementing macro recording and playback,
Benno Schulenberg <=
- Re: [Nano-devel] implementing macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/09
- Re: [Nano-devel] implementing macro recording and playback, Benno Schulenberg, 2017/10/10
- Re: [Nano-devel] implementing macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/10
- Re: [Nano-devel] implementing macro recording and playback, Benno Schulenberg, 2017/10/11
- Re: [Nano-devel] implementing macro recording and playback, Marco Diego Aurélio Mesquita, 2017/10/11
- Re: [Nano-devel] implementing macro recording and playback, Brand Huntsman, 2017/10/12
- Re: [Nano-devel] implementing macro recording and playback, Benno Schulenberg, 2017/10/12
- Re: [Nano-devel] implementing macro recording and playback, Benno Schulenberg, 2017/10/17