Skip to content

Commit

Permalink
fix plain text square bracket indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
uben0 committed Jan 13, 2024
1 parent f3b362d commit ecf8596
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 17 additions & 3 deletions corpus/positive.scm
Original file line number Diff line number Diff line change
Expand Up @@ -6007,15 +6007,16 @@ positive/402
=====================
positive/403
=====================
- [a]a
- [a
a]
--------------------

(source_file
(item
(text)
(text)
(text)
(text)))
(text))
(text))


=====================
Expand Down Expand Up @@ -6100,3 +6101,16 @@ positive/409
(text)
(item))
(text))


=====================
positive/410
=====================
[]
-
--------------------

(source_file
(text)
(text)
(item))
6 changes: 4 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tree_sitter/parser.h>
#include "tree_sitter/parser.h"
#include <stdio.h>
#include <string.h>
#include "unicode.h"
Expand Down Expand Up @@ -575,7 +575,9 @@ bool tree_sitter_typst_external_scanner_scan(
case TERMINATION_INCLUSIVE:
lexer->advance(lexer, false);
lexer->mark_end(lexer);
scanner_dedent(self);
if (scanner_container_at(self, 0) != CONTAINER_BRACKET) {
scanner_dedent(self);
}
case TERMINATION_EXCLUSIVE:
scanner_container_pop(self);
lexer->result_symbol = TOKEN_TERMINATION;
Expand Down

0 comments on commit ecf8596

Please sign in to comment.