fix a bug in the colorer refactoring
As it turns out, changing the color (via change-style) can somtimes split snips, which can change the revision number, which means that the open port into the editor is no longer valid. Since this doesn't seem to happen very much when editing in DrRacket, we just detect this situation and give up on this colorer's port, and hopefully it actually doesn't happen much (the place it happened that let me notice this was when inserting an image via a menu in the drracket test suites)
This commit is contained in:
parent
08c659c5d5
commit
226a7140b5
|
@ -310,6 +310,7 @@ added get-regions
|
|||
(lexer-state-end-pos re-tokenize-ls-argument)
|
||||
(λ (x) #f)))
|
||||
(port-count-lines! re-tokenize-in-argument)
|
||||
(set! rev (get-revision-number))
|
||||
(continue-re-tokenize start-time #t)]))
|
||||
|
||||
(define re-tokenize-lses #f)
|
||||
|
@ -319,7 +320,8 @@ added get-regions
|
|||
(define re-tokenize-lexer-mode-argument #f)
|
||||
(define/private (continue-re-tokenize start-time did-something?)
|
||||
(cond
|
||||
[(and did-something? ((+ start-time 20) . <= . (current-inexact-milliseconds)))
|
||||
[(or (not (= rev (get-revision-number)))
|
||||
(and did-something? ((+ start-time 20) . <= . (current-inexact-milliseconds))))
|
||||
#f]
|
||||
[else
|
||||
;(define-values (_line1 _col1 pos-before) (port-next-location in))
|
||||
|
@ -512,7 +514,6 @@ added get-regions
|
|||
[(and colorer-pending? (= rev (get-revision-number)))
|
||||
(continue-re-tokenize (current-inexact-milliseconds) #f)]
|
||||
[else
|
||||
(set! rev (get-revision-number))
|
||||
(start-re-tokenize (current-inexact-milliseconds))]))
|
||||
(cond
|
||||
[finished?
|
||||
|
|
Loading…
Reference in New Issue
Block a user