Rename parameter.
This commit is contained in:
Родитель
7399067bde
Коммит
cde124344f
10
src/query.ts
10
src/query.ts
|
@ -8,7 +8,7 @@ type Query = {
|
|||
type QueryOptions = {
|
||||
lookBackIndex: number
|
||||
multiWord: boolean
|
||||
match: Match | null
|
||||
previousMatch: Match | null
|
||||
}
|
||||
|
||||
const boundary = /\s|\(|\[/
|
||||
|
@ -18,10 +18,10 @@ export default function query(
|
|||
text: string,
|
||||
key: string,
|
||||
cursor: number,
|
||||
{multiWord, lookBackIndex, match}: QueryOptions = {
|
||||
{multiWord, lookBackIndex, previousMatch}: QueryOptions = {
|
||||
multiWord: false,
|
||||
lookBackIndex: 0,
|
||||
match: null
|
||||
previousMatch: null
|
||||
}
|
||||
): Query | void {
|
||||
// Activation key not found in front of the cursor.
|
||||
|
@ -29,8 +29,8 @@ export default function query(
|
|||
if (keyIndex === -1) return
|
||||
|
||||
if (multiWord) {
|
||||
if (match) {
|
||||
keyIndex = match.position - 1
|
||||
if (previousMatch) {
|
||||
keyIndex = previousMatch.position - 1
|
||||
}
|
||||
|
||||
// Stop matching at the lookBackIndex
|
||||
|
|
|
@ -176,7 +176,7 @@ class TextExpander {
|
|||
const found = query(text, key, cursor, {
|
||||
multiWord,
|
||||
lookBackIndex: this.lookBackIndex,
|
||||
match: this.match
|
||||
previousMatch: this.match
|
||||
})
|
||||
if (found) {
|
||||
return {text: found.text, key, position: found.position}
|
||||
|
|
Загрузка…
Ссылка в новой задаче