]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Fix markdown parser
authorRoberto Castagnola <roberto.castagnola@gmail.com>
Mon, 24 Jul 2023 16:05:22 +0000 (18:05 +0200)
committerRoberto Castagnola <roberto.castagnola@gmail.com>
Mon, 24 Jul 2023 16:08:34 +0000 (18:08 +0200)
autoload/lsp/markdown.vim

index baef36378a030a4c5580662d4259e2ea15822524..529c395b242b7eff8a2fe295283e79c9252b01d8 100644 (file)
@@ -428,9 +428,9 @@ def SplitLine(line: dict<any>, indent: number = 0): list<dict<any>>
     props: []
   }
   for prop in line.props
-    if prop.col + prop.length < pos
+    if prop.col + prop.length - 1 < pos + 1
       cur_line.props->add(prop)
-    elseif prop.col >= pos
+    elseif prop.col > pos + 1
       prop.col -= pos - indent + 1
       next_line.props->add(prop)
     else
@@ -531,7 +531,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
                                      block.level))
        var format = ParseInlines(block.text, line.text->len())
        line.text ..= format.text
-       line.props += line.props
+       line.props += format.props
        document.content += SplitLine(line)
       elseif block.type == 'table'
        var indent = line.text
@@ -676,7 +676,7 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
       continue
     endif
 
-    # a themaic break close all previous blocks
+    # a thematic break close all previous blocks
     if line =~ thematic_break
       CloseBlocks(document, open_blocks)
       if &g:encoding == 'utf-8'