vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit b97786d5308edff0cbee481e2e30f7fb4a046982 parent 79c75daddf320af6ab98f8bd146cb76aab1b08fc Author: orbitalquark <70453897+orbitalquark@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:53:39 -0400 Fix errors with folding in reST lexer The lexer runs without error, but still does not really work. Diffstat:
| M | lua/lexers/rest.lua | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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