Change:
In the debug console, evaluate something, then 3 times. Press up, get Press up again, get again Press up again, get the previous history entry Seems like it always reduces down to 2 entries, or there might be something else weird going on
Oh wait, this is in vscode right?
We are de-duplicating history entries which makes sense for me. This is designed behavior What is the use case of seeing 3 times in history?
The bug is that I see it twice, when I should see it once
I can not repro. What are you doing differnetly than me in this gif Please note that I pressed up only two times at the end. Thus is only once in history !
Hmm, extra steps Execute things as above Press up to go through history, it works Press down to go back Press down a couple extra times - I did this because I was expecting to get back to an empty input if I press down Then, I press up on and nothing happens, it's still on !
Ok, the issue is when you reach the end of history up / down take an extra hit to get the previous or the next one. Duplication is not related. Renaming this issue. I am open for PRs that fix this Code pointer Probably the has an issue at the end of history
Hello. I would like to contribute on this if you are open. I will submit a PR as soon as I fix it :)
To verify: debugging, open debug console , then evaluate sure pressing up gets you all the way back to the end of history in the debug console input sure pressing down gets you immieadly to the previous history element. Thus no duplicatino happens

Discussion:
} public next(): T | null { <del> return this._navigator.next(); </del> <ins> if (this._currentPosition() !== this._elements.length - 1) { return this._navigator.next(); } return null; </ins> } public previous(): T | null { <del> return this._navigator.previous(); </del> <ins> if (this._currentPosition() !== 0) { return this._navigator.previous(); } return null; </ins> } public current(): T | null {

} } <ins> private _currentPosition(): number { const currentElement = this._navigator.current(); if (!currentElement) { return -1; } return this._elements.indexOf(currentElement); } </ins> private _initialize(history: readonly T[]): void { this._history = new Set(); for (const entry of history) {

assert.deepEqual(['2', '3', '1'], toArray(testObject)); }); <ins> test('previous returns null if the current position is the first one', () => { const testObject = new HistoryNavigator(['1', '2', '3']); testObject.first(); assert.deepEqual(testObject.previous(), null); }); test('previous returns object if the current position is not the first one', () => { const testObject = new HistoryNavigator(['1', '2', '3']); testObject.first(); testObject.next(); assert.deepEqual(testObject.previous(), '1'); }); test('next returns null if the current position is the last one', () => { const testObject = new HistoryNavigator(['1', '2', '3']); testObject.last(); assert.deepEqual(testObject.next(), null); }); test('next returns object if the current position is not the last one', () => { const testObject = new HistoryNavigator(['1', '2', '3']); testObject.last(); testObject.previous(); assert.deepEqual(testObject.next(), '3'); }); </ins> test('clear', () => { const testObject = new HistoryNavigator(['a', 'b', 'c']); assert.equal(testObject.previous(), 'c');