some fixes for multiple-mode textinput

#4258 
Amended and pushed.