| 6927 | // The inverse of countColumn -- find the offset that corresponds to |
| 6928 | // a particular column. |
| 6929 | function findColumn(string, goal, tabSize) { |
| 6930 | for (var pos = 0, col = 0;;) { |
| 6931 | var nextTab = string.indexOf("\t", pos); |
| 6932 | if (nextTab == -1) nextTab = string.length; |
| 6933 | var skipped = nextTab - pos; |
| 6934 | if (nextTab == string.length || col + skipped >= goal) |
| 6935 | return pos + Math.min(skipped, goal - col); |
| 6936 | col += nextTab - pos; |
| 6937 | col += tabSize - (col % tabSize); |
| 6938 | pos = nextTab + 1; |
| 6939 | if (col >= goal) return pos; |
| 6940 | } |
| 6941 | } |
| 6942 | |
| 6943 | var spaceStrs = [""]; |
| 6944 | function spaceStr(n) { |