Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Focus the current entry earlier in the generation process (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread authored Dec 19, 2020
1 parent d42b95a commit bef8612
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/mixed/js/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ class Display extends EventDispatcher {
}

let {sentence=null, optionsContext=null, focusEntry=null, scrollX=null, scrollY=null} = state;
if (typeof focusEntry !== 'number') { focusEntry = 0; }
if (!(typeof optionsContext === 'object' && optionsContext !== null)) {
optionsContext = this.getOptionsContext();
state.optionsContext = optionsContext;
Expand Down Expand Up @@ -943,9 +944,11 @@ class Display extends EventDispatcher {
entry.dataset.index = `${i}`;
this._addEntryEventListeners(entry);
container.appendChild(entry);
if (focusEntry === i) {
this._focusEntry(i, false);
}
}

this._focusEntry(typeof focusEntry === 'number' ? focusEntry : 0, false);
if (typeof scrollX === 'number' || typeof scrollY === 'number') {
let {x, y} = this._windowScroll;
if (typeof scrollX === 'number') { x = scrollX; }
Expand Down

0 comments on commit bef8612

Please sign in to comment.