bugGNU nano - Bugs: bug #65991, {runmacro} in a string bind...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #65991: {runmacro} in a string bind discards the rest of the string

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Mon 15 Jul 2024 09:03:01 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 06 Sep 2024 07:38:03 AM UTC, comment #5: 

The fix was released in nano-8.2.

Benno Schulenberg <bens>
Group administrator
Tue 16 Jul 2024 02:49:15 PM UTC, comment #4: 

Thanks for confirming.

Fixed in git, commit c356db9f, by inserting the contents of the macro buffer at the start of the keystroke buffer, thus retaining anything that was already there.

Benno Schulenberg <bens>
Group administrator
Mon 15 Jul 2024 08:30:22 PM UTC, comment #3: 

Can confirm that this resolves the issue (and that it also works with the file #56091 patch implementing {enact}).

Tasos Papastylianou <tpapastylianou>
Mon 15 Jul 2024 03:34:09 PM UTC, comment #2: 

Attached patch should fix the issue.


(file #56275)

Benno Schulenberg <bens>
Group administrator
Mon 15 Jul 2024 03:25:47 PM UTC, comment #1: 

First a more copy-pastable recipe:

echo 'bind M-! "{runmacro} world!{enter}" main' >macrc
echo 'bind M-@ "Hey, {runmacro}, {runmacro}, {runmacro}!{enter}" main' >>macrc

src/nano --rc=macrc

Then record a macro:  M-: hello M-: <Enter>
Then run the two string binds:  M-!  M-@

See that, for each, after the (first) "hello" nothing more follows.

The problem is that calling run_macro() simply overwites the current contents of the keystroke buffer with those of the macro buffer.

The solution is to insert the macro at the start of the keystroke buffer.  Patch is coming up.

Benno Schulenberg <bens>
Group administrator
Mon 15 Jul 2024 09:03:01 AM UTC, original submission:  

To reproduce, bind the following string macros in nanorc:

bind M-! "{runmacro} world!" main
bind M-" "Well {runmacro}, {runmacro}, {runmacro}!" main

Then record an interactive macro in a live nano session, e.g. `M-; hello M-;` (spaces included for readability)
Expected result when activating M-! and M-" respectively:

hello world!
Well hello, hello, hello!

What you get instead:

hello
Well hello


P.S. This also affects {enact} currently under discussion; I ran into this issue while attempting to demonstrate the 'repeat {runmacro} N times' use-case using {enact}.

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-06 bens Open/ClosedOpen Closed
    2024-07-16 bens StatusReady for test Fixed
    2024-07-15 bens Attached File- Added 0001-macro-insert-macro-at-start-of-keystroke-buffer-inst.patch, #56275
        StatusIn progress Ready for test
    2024-07-15 bens StatusNone In progress
        Assigned toNone bens
        SummaryA {runmacro} inside a string bind clears the rest of the keybuffer {runmacro} in a string bind discards the rest of the string

    Back to the top

    Powered by Savane 3.15.
    Corresponding source code