Skip to content

Commit

Permalink
Avoid popup flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmaa committed Aug 22, 2024
1 parent 0255f49 commit 9d54a46
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ext/js/language/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ export class TextScanner extends EventDispatcher {
null
);

if (this._scanResolution === 'word') {
// Move the start offset to the beginning of the word
textSource.setStartOffset(this._scanLength, this._layoutAwareScan, true);
}

if (this._textSourceCurrent !== null && this._textSourceCurrent.hasSameStart(textSource)) {
return;
}
Expand All @@ -484,10 +489,6 @@ export class TextScanner extends EventDispatcher {
let sentence = null;
/** @type {'terms'|'kanji'} */
let type = 'terms';
if (this._scanResolution === 'word') {
// Move the start offset to the beginning of the word
textSource.setStartOffset(this._scanLength, this._layoutAwareScan, true);
}
const result = await this._findDictionaryEntries(textSource, searchTerms, searchKanji, optionsContext);
if (result !== null) {
({dictionaryEntries, sentence, type} = result);
Expand Down

0 comments on commit 9d54a46

Please sign in to comment.