Changes keypress to keyup to avoid losing of style on current line