Skip to content

Commit c59e8f6

Browse files
committed
fix skip-past-token
this bug was introduced in the changes to support invisible parens, specifically commit 6754ed4
1 parent 7d03dc1 commit c59e8f6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

gui-lib/framework/private/color.rkt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ added get-regions
10581058
(skip-past-token ls position))))))))
10591059

10601060
(define/private (skip-past-token ls position)
1061-
(define pos (skip-past-token/ls-relative ls position))
1061+
(define pos (skip-past-token/ls-relative ls (- position (lexer-state-start-pos ls))))
10621062
(and pos (+ pos (lexer-state-start-pos ls))))
10631063

10641064
(define/private (skip-past-token/ls-relative ls position)

gui-test/framework/tests/racket.rkt

+12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
(test-commenting)
1313
(test-get-matching-paren-string)
1414
(open-paren-typing)
15+
(test-forward-match)
1516
(test-text-balanced)
1617
(test-highlighting)
1718
(indentation-tests)
@@ -333,6 +334,17 @@
333334
(check-equal? (text-balanced? "{foo} ((bar) [5.9])" 0 #f) #t)
334335
(check-equal? (text-balanced? "#(1 2 . 3)" 0 #f) #t))
335336

337+
(define (test-forward-match)
338+
(define t (new racket:text%))
339+
(send t insert " (\n")
340+
(send t reset-regions '((3 3) (5 end)))
341+
(send t insert "> (f 01234 56 789 2 3\n")
342+
(send t freeze-colorer)
343+
(send t thaw-colorer)
344+
(check-equal? (send t forward-match 8 (send t last-position)) 13)
345+
(check-equal? (send t forward-match 13 (send t last-position)) 16))
346+
347+
336348
(define (test-highlighting)
337349
(preferences:set 'framework:paren-color-scheme 'shades-of-gray)
338350
(define t (new racket:text%))

0 commit comments

Comments
 (0)