Added functions for correct behavior of down arrow press during text editing