From ca8ad3b88b38034e4dac6715511a749581d0c059 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 14 Feb 2013 19:48:54 -0600 Subject: [PATCH] try to be slightly smarter about invalidating the green region in the line numbers when it moves around specifically, if the before and after green line are right next to each other, then put it into a single edit sequence (which unions the invalidated regions); if not, then we may be jumping far away, so invalidate the two regions and redraw them separately --- collects/framework/private/text.rkt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/collects/framework/private/text.rkt b/collects/framework/private/text.rkt index b273d0de1a..27c9f06708 100644 --- a/collects/framework/private/text.rkt +++ b/collects/framework/private/text.rkt @@ -4288,13 +4288,20 @@ designates the character that triggers autocompletion ;; when the line stays the same, don't invalidate anything (set! old-position (get-start-position))] [else - (when old-position - (invalidate-at-position old-position)) + (define old-position-before old-position) (set! old-position (and (= (get-start-position) (get-end-position)) (get-start-position))) - (when old-position - (invalidate-at-position old-position))]) + (define single-edit-sequence? + (and old-position-before + old-position + (<= (abs (- (position-paragraph old-position-before) + (position-paragraph old-position))) + 1))) + (when single-edit-sequence? (begin-edit-sequence #f #f)) + (when old-position-before (invalidate-at-position old-position-before)) + (when old-position (invalidate-at-position old-position)) + (when single-edit-sequence? (end-edit-sequence))]) (inner (void) after-set-position)) (define/private (invalidate-at-position pos)