mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
markdown-ts-mode: fix first-item indent (bug#81118)
* lisp/textmodes/markdown-ts-mode.el (markdown-ts--fontify-unordered-list-marker): Skip leading whitespace in the node range before applying the display bullet, since the tree-sitter grammar bundles indent into the first list_marker_* node.
This commit is contained in:
parent
07e02917ee
commit
0989625d36
1 changed files with 9 additions and 1 deletions
|
|
@ -1406,8 +1406,16 @@ If NODE is not in a list, return -1."
|
||||||
"Fontify unordered list marker NODE, show a symbol when markup is hidden.
|
"Fontify unordered list marker NODE, show a symbol when markup is hidden.
|
||||||
OVERRIDE, START, and END are passed through to
|
OVERRIDE, START, and END are passed through to
|
||||||
`treesit-fontify-with-override'."
|
`treesit-fontify-with-override'."
|
||||||
(let* ((node-start (treesit-node-start node))
|
;; The tree-sitter markdown grammar includes the leading indentation
|
||||||
|
;; in the first list_marker_minus/plus/star node of a list, so skip
|
||||||
|
;; over any leading whitespace to avoid overwriting the indent with
|
||||||
|
;; the replacement glyph.
|
||||||
|
(let* ((raw-start (treesit-node-start node))
|
||||||
(node-end (treesit-node-end node))
|
(node-end (treesit-node-end node))
|
||||||
|
(node-start (save-excursion
|
||||||
|
(goto-char raw-start)
|
||||||
|
(skip-chars-forward " \t" node-end)
|
||||||
|
(point)))
|
||||||
(face 'markdown-ts-list-marker))
|
(face 'markdown-ts-list-marker))
|
||||||
(treesit-fontify-with-override node-start node-end face
|
(treesit-fontify-with-override node-start node-end face
|
||||||
override start end)
|
override start end)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue