Skip to content

Commit

Permalink
fix: 输入时取消
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Dec 20, 2023
1 parent 94a7dfd commit b4fa603
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ export function activate(context: ExtensionContext) {
const updateSecond = getConfiguration('autoclick').get('updateSecond') as number

context.subscriptions.push(addEventListener('selection-change', (e) => {
console.log('selection-change')
if (timer)
clearTimeout(timer)

const selections = e.selections
const selection = selections[0]

if (!preActive)
preActive = selection.active

if (isChanging)
return

if (selections.length !== 1) {
preActive = null
preKind = null
Expand Down Expand Up @@ -54,13 +61,6 @@ export function activate(context: ExtensionContext) {
return
}

const selection = selections[0]
if (!preActive)
preActive = selection.active

if (isChanging)
return

if (selection.start.line !== selection.end.line)
return

Expand All @@ -82,8 +82,6 @@ export function activate(context: ExtensionContext) {
}
if (selection.start.line === selection.end.line && selection.start.character === selection.end.character) {
// 单击,如果单机超过800ms,则自动选中多个内容
if (preKind === undefined)
return
preActive = selection.active
preSelection = null
let start = selection.start.character
Expand Down

0 comments on commit b4fa603

Please sign in to comment.