Sublime Forum

Placing insert before duplicated region

#1

This has been super annoying because it’s the last thing that needs to be fixed before the plugin is ready.

The goal is to do this, example:

Before:
color : #000;

After:
color: #000;
color : hsla(…);

But I get this:
color : hsla(…);
color: #000;

Wrong order. I duplicate the original region then insert the converted hsla equivalent. The reason is it is referencing the original region position. I need to shift the region either down before inserting. Not clear from the API how to do this. Or if you have another solution?

Thn, help appreciated.

0 Likes

#2

It would be nice to see your source code for this, but I will do some guessing.

I assume you are using the .begin() part of some region. To fix it, you can just use .end() and insert the \n first.

0 Likes