I would like to see this return the position of the cursor in an edit multi-lines because i've tried to make it with alias but i failed...
This is already possible in editboxes in general with $did(name,id).selstart/selend. Apparently it only works in editboxes and not in an editable comboboxes.
Regarding multi-line editboxes, $did().selstart/end there return the positions counting from the very beginning of the text (line 1), so if you editbox contained this for example:
abc
def
g|hi
$did().selstart/end would return 11 (including enter = crlf = 2 chars)
You can translate that to a line-based position with something like this:
alias linesel {
var %s1 = $did($1,$2).selstart, %e1 = $did($1,$2).selend, %sel = $did($1,$2,1).sel
did -c $1-2 %sel
var %s2 = %s1 - $did($1,$2).selstart, %e2 = $calc(%e1 + %s2 - %s1)
did -c $1-2 %sel $calc(%s2 +1) $calc(%e2 +1)
return %s2 %e2
}
$linesel(name,id) returns "X Y" where X = line-based .selstart and Y = line-based .selend.
As the code implies, you can get the number of the line that contains the cursor with $did(name,id,1).sel
Edit: btw it won't work quite correctly if a multi-line segment of the editbox text is selected. In that case, two numbers aren't even enough to provide all necessary information, so a little more complex script would be required (you should be able to modify the current one).
Edit 2: thought of a better method