From c577eb64ef397e9e38d1f892caec04364090f68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigtryggur=20=C3=93marsson?= Date: Sat, 28 Mar 2026 13:31:55 +0100 Subject: [PATCH] Feat: Increase the match amount Increases the match amount by allowing double character to be the last letter if the match uses two letters, increasing matches on default character set from 285 to 481 --- src/command.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/command.ts b/src/command.ts index 73a7598..ecb3a8b 100644 --- a/src/command.ts +++ b/src/command.ts @@ -219,6 +219,7 @@ function findCandidatePositions(editor: vscode.TextEditor, context: ActiveComman // support other keyboard layouts. const singleCharacterSet = 'fjrudkeislwoaqghtyp'; const doubleCharacterSet = 'vncmxzb,;\'[*+-'; + const allCharacterSet = singleCharacterSet + doubleCharacterSet; const selection = editor.selection; const sorted = positions.sort((a, b)=> @@ -241,19 +242,27 @@ function findCandidatePositions(editor: vscode.TextEditor, context: ActiveComman let singleCharIndex = 0; let doubleCharIndex = -1; - + let lastCharacterSet = singleCharacterSet; + let singleCharacterSetExhausted = false; + for(let i = 0; (i < positions.length) && (doubleCharIndex < doubleCharacterSet.length); ++i) { + if (doubleCharIndex === 0 && !singleCharacterSetExhausted) + { + lastCharacterSet = allCharacterSet; + singleCharacterSetExhausted = true; + } + let combo = ''; if (doubleCharIndex >= 0) { combo += doubleCharacterSet.charAt(doubleCharIndex); } - combo += singleCharacterSet.charAt(singleCharIndex); + combo += lastCharacterSet.charAt(singleCharIndex); ++singleCharIndex; - if (singleCharIndex >= singleCharacterSet.length) + if (singleCharIndex >= lastCharacterSet.length) { singleCharIndex = 0; ++doubleCharIndex;