The code could be written so that the flashers (either left or right) continue to flash until the 'straight' switch is activated.
Well, first deactivated then activated.
You should be signalling before starting the turn, to the straight switch should be closed when you start signalling. At some point after than, you begin the turn, so the straight switch is opened. At some later point, you end the turn by straightening out the wheel(?) and the straight switch is closed again. It is at this point that you want to stop the blinking.
You'll need to consider what happens if you change your mind about turning, or accidentally hit the turn signal switch. You don't want to blink the light for the next 67 miles, or have to make an unnecessary turn just to get the damned blinker to stop.