From: Taylor R. Campbell Date: Mon, 26 Mar 2007 23:54:26 +0000 (+0000) Subject: When evaluating a region, if the region is from the REPL buffer, set X-Git-Tag: 20090517-FFI~704 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=56199eb038d915523bd3caa8961159193068ecf8;p=mit-scheme.git When evaluating a region, if the region is from the REPL buffer, set the buffer's point to the line start after the region, not the end of the region. --- diff --git a/v7/src/edwin/intmod.scm b/v7/src/edwin/intmod.scm index 7896ccde2..ec7d413d4 100644 --- a/v7/src/edwin/intmod.scm +++ b/v7/src/edwin/intmod.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: intmod.scm,v 1.125 2007/03/26 23:33:48 riastradh Exp $ +$Id: intmod.scm,v 1.126 2007/03/26 23:54:26 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -687,24 +687,7 @@ If this is an error, the debugger examines the error condition." (region-end region) mark)))) (let ((port (buffer-interface-port buffer #t))) - (let ((input-end - (let ((mark - (let ((end (buffer-end buffer)) - (end* (region-end region))) - (if (mark~ end end*) - (begin - (set-buffer-point! buffer end*) - end*) - end)))) - (cond ((eqv? #\newline (extract-right-char mark)) - (mark1+ mark)) - ((line-start? mark) - mark) - (else - (let ((mark (mark-left-inserting-copy mark))) - (insert-newline mark) - (mark-temporary! mark) - mark)))))) + (let ((input-end (inferior-repl-input-end buffer region))) (move-mark-to! (port/mark port) input-end) (move-mark-to! (ref-variable comint-last-input-end buffer) input-end)) (let ((queue (port/expression-queue port))) @@ -722,6 +705,27 @@ If this is an error, the debugger examines the error condition." (if (not (queue-empty? queue)) (end-input-wait port))))) +(define (inferior-repl-input-end buffer region) + (receive (mark in-buffer?) + (let ((end (buffer-end buffer)) + (end* (region-end region))) + (if (mark~ end end*) + (values end* #t) + (values end #f))) + (let ((mark + (cond ((eqv? #\newline (extract-right-char mark)) + (mark1+ mark)) + ((line-start? mark) + mark) + (else + (let ((mark (mark-left-inserting-copy mark))) + (insert-newline mark) + (mark-temporary! mark) + mark))))) + (if in-buffer? + (set-buffer-point! buffer mark)) + mark))) + (define (inferior-repl-eval-expression buffer expression) (inferior-repl-eval-ok? buffer) (call-with-transcript-output-mark buffer