Skip to content

Commit

Permalink
fix: keyfunc doubleChar for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
wo52616111 committed May 23, 2024
1 parent 1d21886 commit 38f83e8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
21 changes: 19 additions & 2 deletions language/English.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ cldocs=https://capslox.com/capslock-plus/en.html
;----------------------------------------------------------------;
; ## The hotstring settings of TabScript

; - Capslock + Tab will replace the string matching a key name on the left of the cursor with the corresponding value,
; - Capslock + Tab will replace the string matching a key name on the left of the cursor with the corresponding value,
; for example:
; There is "@[email protected]" here, then you can type "@" anywhere, and press "Capslock+Tab", the "@" will be
; replaced with "[email protected]"
Expand Down Expand Up @@ -323,7 +323,7 @@ lang_settingsDemoFileContent_2=
; Capslock + LALt + F1~F12
; Capslock + LALt + 0~9
; Capslock + LALt + a~z
; Capslock + LALt + `-=[]\;',./
; Capslock + LALt + `-=[]\;',./
; Capslock + LALt + Backspace, Tab, Enter, Space, RAlt
; Capslock + Win + 0~9

Expand Down Expand Up @@ -698,6 +698,23 @@ caps_win_0=keyFunc_winbind_binding(10)

;----------------Other Functions----------------

; wrap the selected text with specified characters, or input specified characters
; examples:
;
; "..."
; caps_quote=keyFunc_doubleChar(""")
;
; (...)
; caps_9=keyFunc_doubleChar((,))
;
; {...}
; caps_leftSquareBracket=keyFunc_doubleChar({,})
;
; [...]
; caps_rightSquareBracket=keyFunc_doubleChar([,])
;
keyFunc_doubleChar

; Previous media
keyFunc_mediaPrev

Expand Down
23 changes: 20 additions & 3 deletions language/Simplified_Chinese.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ lang_settingsDemoFileContent_2=
; Capslock + F1~F12
; Capslock + 0~9
; Capslock + a~z
; Capslock + `-=[]\;',./
; Capslock + `-=[]\;',./
; Capslock + Backspace, Tab, Enter, Space, RAlt
; Capslock + LALt + F1~F12
; Capslock + LALt + 0~9
; Capslock + LALt + a~z
; Capslock + LALt + `-=[]\;',./
; Capslock + LALt + `-=[]\;',./
; Capslock + LALt + Backspace, Tab, Enter, Space, RAlt
; Capslock + Win + 0~9

Expand Down Expand Up @@ -372,7 +372,7 @@ caps_t=keyFunc_doNothing
;选中至行首
caps_u=keyFunc_selectHome

;独立剪贴板 1 的粘贴
;独立剪贴板 1 的粘贴
caps_v=keyFunc_paste_1

;backspace
Expand Down Expand Up @@ -670,6 +670,23 @@ caps_win_0=keyFunc_winbind_binding(10)

;----------------其他功能----------------

; 用指定的字符包裹选定的文本,或输出指定的字符
; 例如:
;
; "..."
; caps_quote=keyFunc_doubleChar(""")
;
; (...)
; caps_9=keyFunc_doubleChar((,))
;
; {...}
; caps_leftSquareBracket=keyFunc_doubleChar({,})
;
; [...]
; caps_rightSquareBracket=keyFunc_doubleChar([,])
;
keyFunc_doubleChar

;上一首
keyFunc_mediaPrev

Expand Down
20 changes: 12 additions & 8 deletions lib/lib_keysFunction.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ keyFunc_translate(){
global
selText:=getSelText()
if(selText)
{
{
ydTranslate(selText)
}
else
{
{
ClipboardOld:=ClipboardAll
Clipboard:=""
SendInput, ^{Left}^+{Right}^{insert}
Expand Down Expand Up @@ -238,7 +238,11 @@ keyFunc_doubleChar(char1,char2:=""){
else
{
Clipboard:=char1 . char2
SendInput, +{insert}{left %charLen%}
SendInput, +{insert}
; prevent the left input from interrupting the paste (may occur in vscode)
; fact: tests show that 50ms is not enough
Sleep, 75
SendInput, {left %charLen%}
}
Sleep, 100
Clipboard:=ClipboardOld
Expand Down Expand Up @@ -345,7 +349,7 @@ keyFunc_cut_1(){
CapsLock2:=""
return
}

ClipboardOld:=ClipboardAll
Clipboard:=""
SendInput, ^{x}
Expand Down Expand Up @@ -657,7 +661,7 @@ keyFunc_getJSEvalString(){
if(!ErrorLevel)
{
Clipboard:=result

return
}
}
Expand Down Expand Up @@ -806,7 +810,7 @@ keyFunc_winPin(){
; {
; WinSet, AlwaysOnTop, Off
; WinSet, Transparent, Off
;
;
; return
; }
WinSet, AlwaysOnTop
Expand Down Expand Up @@ -858,15 +862,15 @@ keyfunc_wheel_down(){
Send, {Wheeldown 3}
}


;keys functions end-------------


; 判断是否为连续点击,连续点击时指数增加移动速度
; init 初始单次移动距离
; a 加速度
; max 最大单次移动距离
dynamic_speed(init:=10, a:=0.2, max:=80)
dynamic_speed(init:=10, a:=0.2, max:=80)
{
static N := 0
if (A_ThisHotkey = A_PriorHotkey) and (A_TimeSincePriorHotkey < 300)
Expand Down

0 comments on commit 38f83e8

Please sign in to comment.