Fix bug in M-x goto-char -- it was counting characters from the
authorChris Hanson <org/chris-hanson/cph>
Fri, 4 Oct 1991 06:09:24 +0000 (06:09 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 4 Oct 1991 06:09:24 +0000 (06:09 +0000)
narrowed start of the buffer, when it should have ignored narrowing.

v7/src/edwin/motcom.scm

index 45e894520532f4f77c0175a182102e3b308489c2..2912a2a7073fa45e1008dd0f191e115021791059 100644 (file)
@@ -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))))))
 \f
 (define-variable goal-column
   "Semipermanent goal column for vertical motion,