Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve position from insert statement
#1
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
#2
Function GetQmCodeEditorCaretPositionBeforeInsertingText
Code:
Copy      Help
;/
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
Code:
Copy      Help
str s=
;one
;two
;three

InsertStatement s
int r=GetQmCodeEditorCaretPositionBeforeInsertingText(1)
out r


#ret
mmmmmmm
#3
thanks Gintaras


Forum Jump:


Users browsing this thread: 1 Guest(s)