I have the following macro which adds the string “\” (two slashes) to the end of each line in a selection.
[code]
{
"args":
{
"to": "line"
},
"command": "expand_selection"
},
{
"args": null,
"command": "split_selection_into_lines"
},
{
"args":
{
"by": "characters",
"forward": true
},
"command": "move"
},
{
"args":
{
"characters": "\\\\"
},
"command": "insert"
}
][/code]
Now my question: How can I change this into a toggle-style macro?
i.e. remove the double-slash at the end of each line in the selection if it is present, but add the double slash if it is not present.
This is a very similar idea to the toggle comment menu item.
I tried to locate this menu item to inspect the code but I could not find it.