The instrument number is deleted and the M0 command shifted left. I would guess the M0 should remain in column 2 but hidden and that the C-4`s 00 instrument number should stay in tact?
Just testing this, this is in fact not an API issue but a default renoise behaviour issue.
Using the keyboard shortcut Ctrl-Shift-left arrow, the same thing occurs. The M0 shifts left and the instrument number on the c-4 is cleared. It is worth noting that if it is a numerical panning value and not the M0 value in the panning column, things work as expected .
The m0 is a midi command for the specific instrument (in your case “no instrument”) and belongs to the effect column, hence it moves along to the left if you remove the last note-column.
In your case:Renoise simply retains the midi command value for that instrument and superseeds the original instrument-number of the first column. I’m not sure if that is the purpose, but if you don’t want that to happen, remove the Midi command meanwhile.
Im not sure of the ins and outs of the MIDI commands as I dont use them but it still seems strange behaviour that other pattern data can get over-written in an expand/collapse operation. The operation also affects all patterns in a song so I imagine you could end up with several of these un-intended consequences in your track if you do use MIDI commands.