|
63 | 63 | endfunction
|
64 | 64 | endif
|
65 | 65 |
|
66 |
| -" indent/python.vim |
67 | 66 | function s:Trimline(ln)
|
68 |
| - let pline = getline(a:ln) |
69 |
| - let min = match(pline,'\/[/*]') + 1 |
70 |
| - if min && synIDattr(synID(a:ln, strlen(pline), 0), 'name') =~? '\%(comment\|doc\)' |
71 |
| - let max = match(pline,'.*\zs\/[/*]') + 1 |
72 |
| - while min < max |
73 |
| - let col = (min + max) / 2 |
74 |
| - if synIDattr(synID(a:ln, col, 0), 'name') =~? '\%(comment\|doc\)' |
75 |
| - let max = col |
76 |
| - else |
77 |
| - let min = match(pline,'\/[/*]',col) + 1 |
78 |
| - endif |
79 |
| - endwhile |
80 |
| - let pline = strpart(pline, 0, min - 1) |
81 |
| - endif |
82 |
| - return substitute(pline,'\s*$','','') |
| 67 | + let pline = substitute(getline(a:ln),'\s*$','','') |
| 68 | + let max = max([strridx(pline,'//'),strridx(pline,'/*'),0]) |
| 69 | + while max && synIDattr(synID(a:ln, strlen(pline), 0), 'name') =~? '\%(comment\|doc\)' |
| 70 | + let pline = substitute(strpart(pline, 0, max),'\s*$','','') |
| 71 | + let max = max([strridx(pline,'//'),strridx(pline,'/*'),0]) |
| 72 | + endwhile |
| 73 | + return pline |
83 | 74 | endfunction
|
84 | 75 |
|
85 | 76 | " configurable regexes that define continuation lines, not including (, {, or [.
|
|
0 commit comments