Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.14k stars 299 forks source link

recorded macro: "SyntaxError: unexpected garbage after function body, starting with '}'" #3935

Open ogitha opened 2 years ago

ogitha commented 2 years ago

Short Summary

After recording some key sequences, recorded macros stop working. Any attempt to execute a recorded macro results in a popup saying:

Syntax Error in userscript "(null)". SyntaxError: unexpected garbage after function body, starting with '}' line: 4

Steps to Reproduce

Edit Preferences, and assign key F5 to Start Recording and F7 to Execute Last Macro. Copy a short piece of text. Start recording using F5 Press these keys: ctrl-V, shift-left Stop recording Play macro using F7

Expected results

The macro runs, pasting the copied piece of text and selecting the last pasted character.

Actual results

The result is an error message "SyntaxError: unexpected garbage after function body, starting with '}'" Any macro I try to record and play from that moment on will result in the same error.

Platform Information

Komodo Edit or IDE? - both Komodo Edit and Komodo IDE Komodo Version? - Reproduced now on 12.0.0, but also 10.2.3 and 11.1.0. Operating System (and version)? - Kubuntu 20.04, Kubuntu 18.04

Additional Information

The only way I found to fix this once it happens is to exit Komodo Edit and start it again. The error does not occur if I start recording using the toolbar.

When I try to save the recorded macro as a userscript and edit it, I see this:

// Macro recorded on: Wed Jul 21 2021 18:11:09 GMT+0300 (IDT) komodo.assertMacroVersion(3); if (komodo.view) { komodo.view.setFocus(); } ko.commands.doCommand('cmd_paste') setTimeout(function() { ko.commands.doCommand('cmd_selectCharPrevious') }, 100); // cmd_paste is async }, 100); // cmd_paste is async

The last line seems out of place.