What's the correct way to use bmesh.ops in a modal operator?

I’m writing a modal operator that will do partial loop cuts- rather than cut a loop all the way around an edgering, it creates a loop just within the selected ring edges. It works great as a one-shot operator, but I want to allow the user to be able to scroll the mousewheel to control the number of cuts so it’s consistent with the normal loop cut operator.

The problem is that since my operator works off of an initial selection- and since the geometry is changed by bmesh.ops.subdivide_edgering the initial selection is invalidated after the first update. Attempting to cache the selection is pointless since the data is no longer there, and would result in an access violation crash if you tried.

How can I start with an initial selection and then run bmesh operations on the selection each modal update? I guess I could just not update the geometry after the bmesh op so it wouldn’t change, and thus my initial selection would be preserved- but then the user would not get any realtime feedback that shows the loop placement.

Any ideas?

my current thinking is that i need to ‘simulate’ the cuts and store the ‘new’ vert positions in a gl batch and draw lines, then only perform the bmesh.op when the user commits the modal operation. seems like an awful lot of work for something the op already does…

FML. I just spent the past 5 hours mimicing the functionality behind bmesh.ops.subidivide_edgering and creating the necessary vertex batches to draw GL lines where it will create edges only to find out that SpaceView3D draw handlers don’t work with modal operators unless you’re returning PASS_THROUGH.

[edit: after a long night of sleep I remembered that you can tag an area for redraw, context.area.tag_redraw() unblocks me]