But did you try it duplicating the bug with and without this patch?

The issue is with the X position of the keys.  I suspect that adjusting the size of the L key shifts all the other keys slightly. They are not absolutely positioned, are they?  So the A through K keys have their X position measured, then you switch the size of the L key and A through K move 8 pixels to the left, and then record the new position of the L key.