Home Download Buy Blog Forum Support

rowcol() incorrect column calculation with tabs.

rowcol() incorrect column calculation with tabs.

Postby gcarver on Thu Aug 30, 2012 3:48 am

It appears that view.rowcol() returns a column count not correctly accounting for tab size. If for example I have a line with 1 tab, tab size is set to 4, and I attempt to get the column at the end of the line, rowcol() will return a column location 3 less than expected. If I convert tabs to spaces then rowcol() returns the expected value. I am running ST2 on a 64bit PC.
gcarver
 
Posts: 5
Joined: Thu Aug 30, 2012 3:37 am

Re: rowcol() incorrect column calculation with tabs.

Postby adzenith on Thu Aug 30, 2012 4:53 pm

This is by design. Check out the code for converting tabs to spaces for some helper functions to translate back and forth.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: rowcol() incorrect column calculation with tabs.

Postby gcarver on Fri Aug 31, 2012 12:15 am

Thank you. I thought it might be by design. Perhaps the documentation should clarify that. Not a big deal. Just a bit more work for me.
gcarver
 
Posts: 5
Joined: Thu Aug 30, 2012 3:37 am


Return to Technical Support

Who is online

Users browsing this forum: Markus Gritsch, Yahoo [Bot] and 24 guests