Skip to content

Commit

Permalink
fix skip-past-token
Browse files Browse the repository at this point in the history
this bug was introduced in the changes to support invisible parens, specifically commit 6754ed4

(cherry picked from commit c59e8f6)
  • Loading branch information
rfindler committed Oct 20, 2024
1 parent 7d03dc1 commit fe650f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gui-lib/framework/private/color.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ added get-regions
(skip-past-token ls position))))))))

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

(define/private (skip-past-token/ls-relative ls position)
Expand Down
12 changes: 12 additions & 0 deletions gui-test/framework/tests/racket.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
(test-commenting)
(test-get-matching-paren-string)
(open-paren-typing)
(test-forward-match)
(test-text-balanced)
(test-highlighting)
(indentation-tests)
Expand Down Expand Up @@ -333,6 +334,17 @@
(check-equal? (text-balanced? "{foo} ((bar) [5.9])" 0 #f) #t)
(check-equal? (text-balanced? "#(1 2 . 3)" 0 #f) #t))

(define (test-forward-match)
(define t (new racket:text%))
(send t insert " (\n")
(send t reset-regions '((3 3) (5 end)))
(send t insert "> (f 01234 56 789 2 3\n")
(send t freeze-colorer)
(send t thaw-colorer)
(check-equal? (send t forward-match 8 (send t last-position)) 13)
(check-equal? (send t forward-match 13 (send t last-position)) 16))


(define (test-highlighting)
(preferences:set 'framework:paren-color-scheme 'shades-of-gray)
(define t (new racket:text%))
Expand Down

0 comments on commit fe650f9

Please sign in to comment.