Sublime Forum

View.rowcol and word wrap

#1

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!

0 Likes

#2

+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.


0 Likes

#3

Check out normed_indentation_pt inside of indentation.py in the Default package folder. I think it’ll get you what you want.

0 Likes