Rewrite input history navigation

- Use an offset from the bottom for storing the navigation state

- Rename the navigation functions to upHistory and downHistory for less
  confusion

- Centralize repeating buffer refresh code

GitHub: fixes #22
Merge pull request #42 from veeti/history

Rewrite input history navigation