Forum > SynEdit
how to get line number of text under mouse.position
Josh:
Hi
I had to use Y-1 to get the actual line.
I have tested with 2/3 line synedit as well as 0 line and it returns as expected no bang, unless i am missing something.
But i think a safety/sanity check woud be wise..
Martin_fr:
--- Quote from: Josh on June 19, 2023, 11:40:05 pm ---Hi
I had to use Y-1 to get the actual line.
I have tested with 2/3 line synedit as well as 0 line and it returns as expected no bang, unless i am missing something.
But i think a safety/sanity check woud be wise..
--- End quote ---
You mean it returns non existing lines? => scmLimitToLines ?
Josh:
Hi Martin_fr,
when i was testing ideas, i tried a few of those, but they are based on the position of the caret in synedit, unless i done something wrong of course.
it was giving me the line after the one i was after, so i thought it was something to do with one function being non zero based.
did not check too much, but it solved the issue.
Josh:
Just added test proj that demonstrates
DomingoGP:
--- Quote ---You mean it returns non existing lines? => scmLimitToLines ?
--- End quote ---
The code I have suggested uses [scmIncludePartVisible] which allows to detect if the cursor is below the last text line if we compare the returned row with lines.count.
--- Quote ---I have tested with 2/3 line synedit as well as 0 line and it returns as expected no bang, unless i am missing something.
--- End quote ---
You are right Synedit1.Lines[10000] returns an empty string without any error.
Navigation
[0] Message Index
[#] Next page
[*] Previous page