Fix cursor position when moving through the history

This commit is contained in:
Andrew Resch 2009-04-24 18:21:31 +00:00
parent 714cd0ed80
commit 1d5bc7669f
1 changed files with 3 additions and 0 deletions

View File

@ -301,15 +301,18 @@ class Screen(CursesStdIO):
# Going back in the history
self.input_history_index -= 1
self.input = self.input_history[self.input_history_index]
self.input_cursor = len(self.input)
elif c == curses.KEY_DOWN:
if self.input_history_index + 1 < len(self.input_history):
# Going forward in the history
self.input_history_index += 1
self.input = self.input_history[self.input_history_index]
self.input_cursor = len(self.input)
elif self.input_history_index + 1 == len(self.input_history):
# We're moving back down to an incomplete input
self.input_history_index += 1
self.input = self.input_incomplete
self.input_cursor = len(self.input)
# Cursor movement
elif c == curses.KEY_LEFT: