Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)=>
Expand All @@ -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;
Expand Down