Added escape management to end editing