From 5b63adbbb0e0604be05bf61cff80df19df537af4 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 8 Mar 2006 23:04:54 +0000 Subject: [PATCH] svn: r2397 original commit: 4a78a1d1ee0f6932df2413ffb46d58a61bed0853 --- collects/framework/private/scheme.ss | 45 +++++++++++++++++++--------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/collects/framework/private/scheme.ss b/collects/framework/private/scheme.ss index 9853fc4a..e83eac18 100644 --- a/collects/framework/private/scheme.ss +++ b/collects/framework/private/scheme.ss @@ -886,23 +886,40 @@ (begin-edit-sequence) (let ([before-text "(let ([ans "] [after-text "])\n"] - [after-text2 "\nans)"] + [after-text2 "(printf \"~s\\n\" ans)\nans)"] [end-l (get-forward-sexp pos)]) - (insert after-text2 end-l end-l) - (insert after-text end-l end-l) - (insert before-text pos pos) - (let ([blank-line-pos (+ end-l (string-length after-text) (string-length before-text))]) - (set-position blank-line-pos blank-line-pos)) - (tabify-selection - (- pos (string-length before-text)) - (+ end-l - (string-length before-text) - (string-length after-text) - (string-length after-text2)))) + (cond + [end-l + (insert after-text2 end-l end-l) + (insert after-text end-l end-l) + (insert before-text pos pos) + (let ([blank-line-pos (+ end-l (string-length after-text) (string-length before-text))]) + (set-position blank-line-pos blank-line-pos)) + (tabify-selection + (- pos (string-length before-text)) + (+ end-l + (string-length before-text) + (string-length after-text) + (string-length after-text2)))] + [else + (bell)])) (end-edit-sequence)) - (define/public (move-sexp-out pos) - (void)) + (define/public (move-sexp-out begin-inner) + (begin-edit-sequence) + (let ([end-inner (get-forward-sexp begin-inner)] + [begin-outer (find-up-sexp begin-inner)]) + (cond + [(and end-inner begin-outer) + (let ([end-outer (get-forward-sexp begin-outer)]) + (cond + [end-outer + (delete end-inner end-outer) + (delete begin-outer begin-inner) + (tabify-selection begin-outer (+ begin-outer (- end-inner begin-inner)))] + [else (bell)]))] + [else (bell)])) + (end-edit-sequence)) (inherit get-fixed-style) (define/public (mark-matching-parenthesis pos)