]> Cypherpunks repositories - gostls13.git/commit
fmt: measure width in runes not bytes with %c and %q for ints
authorMihai Borobocea <MihaiBorobocea@gmail.com>
Tue, 29 Jul 2014 23:46:53 +0000 (16:46 -0700)
committerRob Pike <r@golang.org>
Tue, 29 Jul 2014 23:46:53 +0000 (16:46 -0700)
commitbfdeb57cc31d5db0501e4d364b74088f5c0e60b1
treee912a7a33a7918cbc77adf93f1eae1f22409c867
parentd2204e6c0ee18d9a1728e01d233d03062936961c
fmt: measure width in runes not bytes with %c and %q for ints

This is meant to share my progress on Issue 8275, if it's useful to you. I'm not familiar with the formatter's internals, so this change is likely naive.

Change these calls to measure width in runes not bytes:
fmt.Printf("(%5q)\n", '§')
fmt.Printf("(%3c)\n", '§')

 Fixes #8275.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/104320043
src/pkg/fmt/fmt_test.go
src/pkg/fmt/format.go