by adzenith on Tue Feb 08, 2011 5:26 pm
Oh, sweet, I didn't think to try passing an empty string there.
I'm working on an elastic tabstops plugin, because I thought it'd be fun and pretty cool.
So I'm waiting for the buffer to be modified, and then I'm inserting spaces in preceding and following lines in order to fix the alignment. Ideally these insertions would be part of the same edit as the edit that caused the on_modified callback, but I didn't think it was possible to get a reference to the previous edit and add to it. I've been thinking of doing something like figuring out what was added to the buffer, calling view.run_command("undo"), and then starting an edit and adding the text back as well as the aligning spaces.
I sort of stopped working on it because I couldn't figure out how to not get called back, but I'll try the code you suggested and let you know how it goes. I tried using a flag before and I had trouble because it seemed like on_modified wouldn't get called again until it had returned, i.e. until it had already set the flag back to false.