Could Xmodmap be used to do the same?
However scrolling through time can have multiple meanings. One is that when you scroll you go back in time and change the past and now future does not exist. Have a file with ‘abc’ written in it. Select it and replace it with ‘123’. Now scroll-undo and you have ‘abc’ back. Select it and replace it with ‘xyz’. No amount of scrolling will bring ‘123’ back. That’s what happens when you simply bind undo and redo to scroll-wheel.
Now you could scroll back in time. And when you start typing it could be considered that you copied state from the past and now you are back in present. Then when you scroll back you undo your undo. I think vim has this implemented under :earlier 10m and :later 5s.
However there is one more much more interesting interpretation. Consider every change as a diff. Then when you go back in time and change the past it works like git-rebase-interactive. You are rewritting history. When you go to the present. You see all your edits back.
In my experimental text editor project I would like to introduce some diff concepts to the changes being made to a file. At least in case when editor detects file change and gives option to ignore or reload file I would like to have a third option: diff. It could also be nice to be able to serialize undo buffer as a diff or series of diffs.
Vim goes even further than tacking the new changes onto the end of the linear history: it keeps an undo tree. You can traverse it in earlier/later fashion (by change number; jumps between branches; like hg up -r 'last(:. and not .)'/hg up -r 'first(.: and not .)'; or in up-the-tree-and-back-again fashion (undo/redo; like the evolve extension’s hg previous/hg next). Undotree is a plugin that lets you navigate the tree visually.
hg up -r 'last(:. and not .)'
hg up -r 'first(.: and not .)'
I couldn’t see how to do it with xmodmap. You can use the keyboard mouse mode to turn keystrokes into mouse clicks, but not the reverse.