I’m currently using view.replace(_, region_name, string_name)
in two different places: inside a TextCommand run
and inside Event Listener on_load_async
. First works fine, second gives "cannot find global variable “_” " error.
It looks like I can’t get edit
parameter anywhere outside TextCommand class
. That means I cannot use view.replace
anywhere but in TextCommand
.
So the question is, am I right? Do I have to create a TextCommand
routine and move all the replace
code there from EventListener
?
Using edit parameter in view.replace
0 Likes
kingkeith
#2
correct, all changes to the buffer must be done as part of a TextCommand
, where the edit
object is active
0 Likes