File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,10 @@ filetype.detect_from_modeline = function(filepath)
135135 return " "
136136 end
137137 local lines = vim .split (tail , " \n " )
138- return filetype ._parse_modeline (lines [# lines ])
138+ local idx = lines [# lines ] ~= " " and # lines or # lines - 1
139+ if idx >= 1 then
140+ return filetype ._parse_modeline (lines [idx ])
141+ end
139142end
140143
141144filetype .detect_from_shebang = function (filepath )
Original file line number Diff line number Diff line change 835835function Path :iter ()
836836 local data = self :readlines ()
837837 local i = 0
838- local n = table . getn ( data )
838+ local n = # data
839839 return function ()
840840 i = i + 1
841841 if i <= n then
@@ -861,7 +861,7 @@ function Path:readbyterange(offset, length)
861861 offset = stat .size + offset
862862 end
863863
864- data = " "
864+ local data = " "
865865 while # data < length do
866866 local read_chunk = assert (uv .fs_read (fd , length - # data , offset ))
867867 if # read_chunk == 0 then
You can’t perform that action at this time.
0 commit comments