diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 14:57:37 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 14:57:56 -0700 |
| commit | 4fa9757fa27d79a0cda399dcf3b711f4d0d60457 (patch) | |
| tree | a67d210b87912ac023822b3e69c97c406659e139 /files.lua | |
| parent | 0fe94570b5c33e01472f61fcd564809f93e1b08a (diff) | |
Better handling of parsing non-filechunks text.
Diffstat (limited to 'files.lua')
| -rw-r--r-- | files.lua | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -229,7 +229,15 @@ Files.get_line_number = function(str, pos) end Files.get_line = function(str, line_no) local line_starts = Files.get_line_starts(str) - return str:sub(line_starts[line_no] or 1, (line_starts[line_no + 1] or 1) - 2) + local start = line_starts[line_no] + if not (start) then + return + end + local stop = line_starts[line_no + 1] + if not (stop) then + return + end + return str:sub(start, stop - 2) end local get_lines = re.compile([[ lines <- {| line (%nl line)* |} line <- {[^%nl]*} |
