Event handling for the TUI application.
This module is adapted from Serie, a git commit graph visualizer. Original code by lusingander, licensed under MIT.