Optimise keystroke handling in graph mode