diff options
| author | orbitalquark <70453897+orbitalquark@users.noreply.github.com> | 2024-09-18 13:53:39 -0400 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2025-01-04 12:24:25 -0700 |
| commit | cc18cea14d1f836abcebb84a96f5029431474255 (patch) | |
| tree | 2fff4082cd7d9a19273c0d85511260ee2a7bc9e4 /lua | |
| parent | 01f013e851556065147f1f33463c70ff3d6194a8 (diff) | |
| download | vis-cc18cea14d1f836abcebb84a96f5029431474255.tar.gz vis-cc18cea14d1f836abcebb84a96f5029431474255.tar.xz | |
Fix errors with folding in reST lexer
The lexer runs without error, but still does not really work.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lexers/rest.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lua/lexers/rest.lua b/lua/lexers/rest.lua index 9340fc2..cf739f2 100644 --- a/lua/lexers/rest.lua +++ b/lua/lexers/rest.lua @@ -173,7 +173,7 @@ local sphinx_levels = { ['#'] = 0, ['*'] = 1, ['='] = 2, ['-'] = 3, ['^'] = 4, ['"'] = 5 } -function lex:fold(text, start_pos, start_line, start_level) +function lex:fold(text, start_line, start_level) local folds, line_starts = {}, {} for pos in (text .. '\n'):gmatch('().-\r?\n') do line_starts[#line_starts + 1] = pos end local style_at, CONSTANT, level = lexer.style_at, lexer.CONSTANT, start_level @@ -185,7 +185,7 @@ function lex:fold(text, start_pos, start_line, start_level) local c = text:sub(pos, pos) local line_num = start_line + i - 1 folds[line_num] = level - if style_at[start_pos + pos - 1] == CONSTANT and c:find('^[^%w%s]') then + if style_at[pos - 1] == CONSTANT and c:find('^[^%w%s]') then local sphinx_level = FOLD_BASE + (sphinx_levels[c] or #sphinx_levels) level = not sphinx and level - 1 or sphinx_level if level < FOLD_BASE then level = FOLD_BASE end |
