Home Download Buy Blog Forum Support

view.rowcol and word wrap

view.rowcol and word wrap

Postby adzenith on Fri Sep 23, 2011 2:06 am

view.rowcol gets the line number in the buffer and the character number in that line.
What I'd like is to get the line number in the view (i.e. the "virtual" line number, as it were) as well as the character number on that virtual line, so I can tell how far down and to the right I am even when word-wrap is turned on. Is there a way to do this that I'm just not seeing? I really don't want to try replicating Sublime Text's word-wrap functionality in Python just to figure out a virtual line number.
I'd also like it if there were an equivalent for view.text_point as well.

Thanks much!
adzenith
 
Posts: 1215
Joined: Mon Oct 19, 2009 9:12 pm

Re: view.rowcol and word wrap

Postby NevilleBagnall on Sat Oct 01, 2011 3:47 pm

+1 on that.

I'm less worried about line wrap, but I'm attempting to develop a columnar sort plugin (similar to that in TextPad) and in my case the issue is Tabs. They only count as a single character, but display as multiples. So when I attempt to extract a column from a line with a tab, I get something different than expected (the regions have been thrown away by necessity at this point). See below for the effect. The first line has four spaces, the second and third have a single tab.

col_error.png
col_error.png (24.31 KiB) Viewed 933 times
NevilleBagnall
 
Posts: 2
Joined: Sat Oct 01, 2011 3:25 pm

Re: view.rowcol and word wrap

Postby adzenith on Mon Oct 03, 2011 7:21 pm

Check out normed_indentation_pt inside of indentation.py in the Default package folder. I think it'll get you what you want.
adzenith
 
Posts: 1215
Joined: Mon Oct 19, 2009 9:12 pm


Return to Plugin Development

Who is online

Users browsing this forum: Exabot [Bot] and 10 guests