329 Public method to determine the indentation level. |
329 Public method to determine the indentation level. |
330 |
330 |
331 @param tabsize The length of a tab stop. (integer) |
331 @param tabsize The length of a tab stop. (integer) |
332 @return indentation level (integer) |
332 @return indentation level (integer) |
333 """ |
333 """ |
334 # count, il = self.norm |
334 ## count, il = self.norm |
335 # for i in range(len(count)): |
335 ## for i in range(len(count)): |
336 # if count[i]: |
336 ## if count[i]: |
337 # il = il + (i/tabsize + 1)*tabsize * count[i] |
337 ## il = il + (i/tabsize + 1)*tabsize * count[i] |
338 # return il |
338 ## return il |
339 |
339 |
340 # quicker: |
340 ## quicker: |
341 # il = trailing + sum (i/ts + 1)*ts*count[i] = |
341 ## il = trailing + sum (i/ts + 1)*ts*count[i] = |
342 # trailing + ts * sum (i/ts + 1)*count[i] = |
342 ## trailing + ts * sum (i/ts + 1)*count[i] = |
343 # trailing + ts * sum i/ts*count[i] + count[i] = |
343 ## trailing + ts * sum i/ts*count[i] + count[i] = |
344 # trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] = |
344 ## trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] = |
345 # trailing + ts * [(sum i/ts*count[i]) + num_tabs] |
345 ## trailing + ts * [(sum i/ts*count[i]) + num_tabs] |
346 # and note that i/ts*count[i] is 0 when i < ts |
346 ## and note that i/ts*count[i] is 0 when i < ts |
347 |
347 |
348 count, trailing = self.norm |
348 count, trailing = self.norm |
349 il = 0 |
349 il = 0 |
350 for i in range(tabsize, len(count)): |
350 for i in range(tabsize, len(count)): |
351 il = il + i / tabsize * count[i] |
351 il = il + i / tabsize * count[i] |