Skip to content

Commit

Permalink
feat: do not display hint with untranslated content (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Jul 11, 2024
1 parent cddddc5 commit 21b16bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/controller/immersive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export function RegisterTranslator(ctx: Context) {
if (!translatedText)
continue

// Skip if the translated text is the same as input
if (
translatedText.toLowerCase() === phrase.toLowerCase()
|| translatedText.toLowerCase() === match[0].toLowerCase()
)
continue

const startPos = editor.document.positionAt(match.index)
const endPos = editor.document.positionAt(match.index + phrase.length)
const range = new Range(startPos, endPos)
Expand Down

0 comments on commit 21b16bf

Please sign in to comment.