Skip to content

Commit e3d7c55

Browse files
committed
Fix out of scope variable in ghcmod#util#tocol
Solves undefined variable error in line `return l:i + 1'.
1 parent 7e5f610 commit e3d7c55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

autoload/ghcmod/util.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ endfunction "}}}
5656

5757
function! ghcmod#util#tocol(line, col) "{{{
5858
let l:str = getline(a:line)
59+
let l:len = len(l:str)
5960
let l:col = 0
60-
for l:i in range(1, len(l:str))
61+
for l:i in range(1, l:len)
6162
let l:col += (l:str[l:i - 1] ==# "\t" ? 8 : 1)
6263
if l:col >= a:col
6364
return l:i
6465
endif
6566
endfor
66-
return l:i + 1
67+
return l:len + 1
6768
endfunction "}}}
6869

6970
function! ghcmod#util#wait(proc) "{{{

0 commit comments

Comments
 (0)