REPL: fix history_prev

Was broken by tracking the wrong key_repeats.
This introduces a function to temporarily stack away the key repeats
counter.