Close #219 : display mode wrong after recursive changeMode call.

The variable currentMode might have been reset when mode entry changed
the editor mode *again*. Make sure to set the mode of the UI to this
newer mode.

Based on original commit of @igrekster.