From 5aeca646d463ba4b065d0301465fdcf93415f7b5 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 16 Aug 2013 21:23:15 -0500 Subject: [PATCH] fix a bug found by the lexer stress test Unfortunately, not the bug I was hoping to find. This bug appears to be very old, however; perhaps as old as the colorer itself. --- pkgs/gui-pkgs/gui-lib/framework/private/color.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/gui-pkgs/gui-lib/framework/private/color.rkt b/pkgs/gui-pkgs/gui-lib/framework/private/color.rkt index 67b6213868..6dfdd9fdb3 100644 --- a/pkgs/gui-pkgs/gui-lib/framework/private/color.rkt +++ b/pkgs/gui-pkgs/gui-lib/framework/private/color.rkt @@ -118,7 +118,7 @@ added get-regions ;; The tree of tokens that have been invalidated by an edit ;; but might still be valid. invalid-tokens ; = (new token-tree%) - ;; The position right before the ainvalid-tokens tree + ;; The position right before the invalid-tokens tree invalid-tokens-start ; = +inf.0 invalid-tokens-mode ;; The position right before the next token to be read @@ -479,7 +479,9 @@ added get-regions (set-lexer-state-invalid-tokens-start! ls (+ (lexer-state-invalid-tokens-start ls) tok-end change-length)) - (set-lexer-state-invalid-tokens-mode! ls (and orig-data (data-lexer-mode orig-data))))) + (set-lexer-state-invalid-tokens-mode! ls (and orig-data (data-lexer-mode orig-data))) + (when (<= edit-start-pos (lexer-state-current-pos ls)) + (set-lexer-state-current-pos! ls (+ (lexer-state-current-pos ls) change-length))))) ((> edit-start-pos (lexer-state-current-pos ls)) (set-lexer-state-invalid-tokens-start! ls