mirror of https://github.com/golang/go.git
cmd/guru: use byte (not rune) count in -modified archive
Change-Id: I7fc575c8ec7a8170e64719419079d6742f47b119 Reviewed-on: https://go-review.googlesource.com/19744 Reviewed-by: Dominik Honnef <dominik@honnef.co> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
b0452eeec4
commit
86372b3255
|
|
@ -192,10 +192,18 @@ current buffer in the format specified by guru's -modified flag."
|
|||
(progn
|
||||
(insert (format "%s\n%d\n"
|
||||
(buffer-file-name b)
|
||||
(buffer-size b)))
|
||||
(insert-buffer-substring b))))
|
||||
(go-guru--buffer-size-bytes b)))
|
||||
(insert-buffer-substring b))))
|
||||
(buffer-list)))
|
||||
|
||||
(defun go-guru--buffer-size-bytes (&optional buffer)
|
||||
"Return the number of bytes in the current buffer.
|
||||
If BUFFER, return the number of characters in that buffer instead."
|
||||
(with-current-buffer (or buffer (current-buffer))
|
||||
(string-bytes (buffer-substring (point-min)
|
||||
(point-max)))))
|
||||
|
||||
|
||||
(defun go-guru--goto-pos (posn)
|
||||
"Find the file containing the position POSN (of the form `file:line:col')
|
||||
set the point to it, switching the current buffer."
|
||||
|
|
|
|||
Loading…
Reference in New Issue