Current code, there are two questions: (Below is an animated GIF demo and related code)
1. After the highlight code is displayed, the cursor position is at the end, and F2 cannot be used directly.
2. If there is a single-line AutoText, the positioning is not accurate.
_____________________________________________________________________
I have a feature request:
When I press the mouse right click on the AutoText, I can execute it instead of opening it.
For example, when I right click on sub.sub3, the Notepad program will open.
Autotext test
Trigger $t
Macro Code+filter
1. After the highlight code is displayed, the cursor position is at the end, and F2 cannot be used directly.
2. If there is a single-line AutoText, the positioning is not accurate.
_____________________________________________________________________
I have a feature request:
When I press the mouse right click on the AutoText, I can execute it instead of opening it.
For example, when I right click on sub.sub3, the Notepad program will open.
Autotext test
Trigger $t

[size=large]/b/i/c/m
ata :sub.Sub2 ;;china
tes :sub.Sub1 ;;commnet
te :"hello" ;;heloo
te :sub.Sub3 ;;run notepad
#sub Sub1 m ;;tes commnet
_s=
F
;english name
;english name2
PasteAutoInputDialog(_s)
#sub Sub2 m ;;ata china
_s=
F
;china
PasteAutoInputDialog(_s)
#sub Sub3 m ;;te run notepad
run "notepad"[/size]
Macro Code+filter
[size=large]out
str s.getsel
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
_s=atn
ARRAY(str) aList=atn
IQmDropdown ddl
int inERS
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 ComboBox 0x54230641 0x0 11 8 120 173 ""
;4 ComboBox 0x54230641 0x0 145 8 174 172 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""
str controls = "3 4"
str cb3 cb4
cb3=_s
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,CB_SelectString(id(3 hDlg) "test")
,
,case WM_DESTROY
,
,case WM_COMMAND goto messages2
ret
;messages2
int hcb2=id(4 hDlg) ;;combo box
sel wParam
,case IDOK
,
,case IDCANCEL
,
,case CBN_SELENDOK<<16|3
,str cb1si
,_i=CB_SelectedItem(lParam cb1si)
,str cb2ii itemscb2=sub.gotoitemedit(cb1si)
,SendMessage(hcb2 CB_RESETCONTENT 0 0)
,itemscb2.findreplace(":sub." " ")
,itemscb2.findreplace(";;" " ")
,foreach cb2ii itemscb2
,,CB_Add(hcb2 cb2ii)
,
,case CBN_DBLCLK<<16|4
,str cb2t
,_i=CB_SelectedItem(lParam cb2t)
,_s.getwintext(id(3 hDlg))
,mac+ _s
,int c=GetQmCodeEditor
,SendMessage(c SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(cb2t "Sub." 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)
,
,SendMessage(c SCI.SCI_SETSELBACK 0 0x00FF00)
,'SE
,
,case CBN_EDITCHANGE<<16|3 sub.OnTextChanged lParam
,
ret 1
#sub gotoitemedit
function~ ~name
str pattern="(?:.*\:sub\..*)"
_s.getmacro(name 0)
str ss d
int i
ARRAY(str) a
findrx(_s pattern 0 4 a)
for i 0 a.len
,d.formata("%s[]" a[0 i])
ret d.trim
#sub OnTextChanged v
function hEdit
if(inERS) ret
if(ddl) ddl.Close; ddl=0
str s.getwintext(hEdit)
if(!s.len) ret
ICsv x._create
x.AddRow1(0 "")
int i
for i 0 aList.len
,if(find(aList[i] s 0 1)<0) continue
,x.AddRow1(-1 aList[i])
if(!x.RowCount) ret
if(ShowDropdownList(x i 0 1 hEdit 0 0 0 ddl)&QMDDRET_SELOK=0) ret
s=x.Cell(i+1 0)
inERS=1
EditReplaceSel hEdit 0 s 1
inERS=0[/size]