Posts: 1,337
Threads: 61
Joined: Jul 2006
Is it possible to retrieve the position or the line number from code inserted using InsertStatement?If code is multi line there is a link generated in qm output that will return the cursor to the beginning of the line. But i was looking for a way to do this without having to click that link. i guess i could enumerate the text of the qm item and find it that way but was hoping there was an easier way
Posts: 12,092
Threads: 142
Joined: Dec 2002
Function
GetQmCodeEditorCaretPositionBeforeInsertingText
;/
function# [flags] ;;flags: 1 go to that position
int c=GetQmCodeEditor
SendMessage(c SCI.SCI_UNDO 0 0)
int r=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(c SCI.SCI_REDO 0 0)
if(flags&1) SendMessage(c SCI.SCI_GOTOPOS r 0)
ret r
;https://www.scintilla.org/ScintillaDoc.html
test
Macro
Macro349
str s=
;one
;two
;three
InsertStatement s
int r=GetQmCodeEditorCaretPositionBeforeInsertingText(1)
out r
#ret
mmmmmmm
Posts: 1,337
Threads: 61
Joined: Jul 2006