Check for past/future state in undo/redo before setting breakpoint

This isn't a problem when using the UI buttons as they get disabled
but the command keys can still trigger these methods.

Also fix hasPastState to include check for small stack. This fixes
an existing bug where the undo button doesn't become active until
~1s after the first change is commited (i.e. after the small stack
is committed to the big stack).

Bug: 52113
Change-Id: Idbd34953c805620881a609409290256462af80a5
Merge "Check for past/future state in undo/redo before setting breakpoint"