To the solution (to avoid misunderstanding): 1: The most important thing is that the cursor should always be in the visible area right after toggling. 2: A special case is when the cursor was not moved during toggling (then the cursor should have exactly the same position like it was before toggling 2x).