 john.byrne
Member
|
What functions are there to get the line numbers of the current selection?
|
 NickDMax
Member
|
I am going to assume that you are talking about PYPN:
The selection is always between the Anchor and the CurrentPos. You can use the function sci.LineFromPosition to get the line number of a particular position.
Example:
sci = scintilla.Scintilla(pn.CurrentDoc());
if ( sci.Anchor <= sci.CurrentPos):
line1 = sci.LineFromPosition(sci.Anchor);
line2 = sci.LineFromPosition(sci.CurrentPos);
else:
line2 = sci.LineFromPosition(sci.Anchor);
line1 = sci.LineFromPosition(sci.CurrentPos);
pn.AddOutput("beg: " + str(line1+1) + "n")
pn.AddOutput("end: " + str(line2+1) + "n")
|
 NickDMax
Member
|
This would be a great thing to add to the status bar with the other selection information. Any hints on where to look to add this Simon? I have a week of vacation so maybe I can get in a patch.
|
 simon
Key Master
|
CTextView::SetPosStatus
http://code.google.com/searchframe#RFQeWrsIjxs/pnwtl/textview.cpp&q=TextView%20package:pnotepad%5C.googlecode%5C.com&l=554
Thanks!
|
 NickDMax
Member
|
Thanks, I think I can add that in. Something like:
“%d Characters over %d Line(s) Selected”
maybe also update the rectangular selection to give an [%d : %d] Col(s) x Row(s).
|
 simon
Key Master
|
Yes, in fact I was thinking the status bar might be better saying Line: %d Column: %d, although that does place additional burden on translators. The current text is cryptic.
|