Move cursor to end of line when accessing history in console.

Use local sinon, fix browser tests.