add ai to smartly choose the end of interested key stroke to smooth the transition from keystroke to inactive(0)