Page 1 of 1
plugin Macros
Posted: 22.08.2021 13:41
by LuNik700
Hi,
there seems to be a simular issue with recorded macros as there was with alignments ...
The recorded macro does not work on the last line of a document when CRLF is missing.
Do you need screenshots reproduce this behavior?
And a suggestion to add a little bit more convenience ...
If you need a macro to run until the end of the document, then beside checking the options "While text changes" and "Until caret on last line" you need to set the option "Times" to "0"
Wouldn't it in this case make sense to deactivate "Times" when those 2 options are set?
Thanks a lot for your kind support in advance!
Ludger
Posted: 22.08.2021 15:36
by uvviewsoft
About 'until caret on last line'.
I see it.
IMO it's not a bug. Code from plugin
Code: Select all
def _run_chk():
for s in _mcr:
exec(s)
if ed.get_carets()[0][1] >= ed.get_line_count()-1:
return True
it means that plugin runs all items from macro, and after each item it checks that we are on the last line. So - it stops if caret is on the last line. And macro don't work for last line.
Posted: 22.08.2021 15:40
by uvviewsoft
>>Wouldn't it in this case make sense to deactivate "Times" when those 2 options are set?
'Times' makes sense even when using 'until caret on last line'. Macro will stop on both events: 'times' (if >0) + 'until on last line'.
Posted: 22.08.2021 19:33
by LuNik700
Times' makes sense even when using 'until caret on last line'. Macro will stop on both events: 'times' (if >0) + 'until on last line'.
... but why should I check "While text changes" and "Until caret on last line" when I only want the macro to run n times???
About 'until caret on last line'.
I see it.
IMO it's not a bug.
...
it means that plugin runs all items from macro, and after each item it checks that we are on the last line. So - it stops if caret is on the last line. And macro don't work for last line.
That would mean that one must record a macro in a way that the cursor is on the last character of the line (respectivly "behind" the position I want to change) when the macro is ever supposed to run over the whole document (or alternatively I would have to insert a extra CRLF).
This perhaps works like designed but I think that's a far too complicated approach. From other editors I know functionality that gives the opportunity to let the macro run until the end of the document. For my needs that would be sufficient.
Best regards
Ludger
Posted: 22.08.2021 19:54
by uvviewsoft
Maybe plugin can be fixed- insert last EOL, then work, then delete that EOL. it will be the easy fix. How to fix that another way- IDK...
Posted: 22.08.2021 20:00
by LuNik700
Yep, that what I meant by
alternatively I would have to insert a extra CRLF
...
Have a nice evening
Ludger
Posted: 23.08.2021 10:07
by uvviewsoft
Fix is applied to Macros, plugin is updated now.
Posted: 24.08.2021 10:37
by LuNik700
... already installed the new version. For me it works fine!
This is a really active project. Thanks for that fast reaction!!!