From f59c4ea3b64039b775cba096faf295bfbf3edc0c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 4 Oct 1991 06:09:24 +0000 Subject: [PATCH] Fix bug in M-x goto-char -- it was counting characters from the narrowed start of the buffer, when it should have ignored narrowing. --- v7/src/edwin/motcom.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/v7/src/edwin/motcom.scm b/v7/src/edwin/motcom.scm index 45e894520..2912a2a70 100644 --- a/v7/src/edwin/motcom.scm +++ b/v7/src/edwin/motcom.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/motcom.scm,v 1.43 1991/08/06 22:04:26 arthur Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/motcom.scm,v 1.44 1991/10/04 06:09:24 cph Exp $ ;;; ;;; Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology ;;; @@ -107,11 +107,15 @@ With arg from 0 to 10, goes up that many tenths of the file from the end." (quotient (* n (region-count-chars region)) 10))) (define-command goto-char - "Goto line ARG, counting from char 1 at beginning of buffer." + "Goto char ARG, counting from char 1 at beginning of buffer." "NGoto char" (lambda (n) - (set-current-point! - (mark+ (buffer-start (current-buffer)) (- n 1) 'ERROR)))) + (let ((group (buffer-group (current-buffer)))) + (let ((index (- n 1))) + (if (or (< index (group-start-index group)) + (> index (group-end-index group))) + (editor-error)) + (set-current-point! (make-mark group index)))))) (define-variable goal-column "Semipermanent goal column for vertical motion, -- 2.25.1