1
0
mirror of https://github.com/golang/go synced 2024-09-25 01:20:13 -06:00

break tabwriter columns when starting a new block of indented statements

R=r
DELTA=16  (15 added, 0 deleted, 1 changed)
OCL=32475
CL=32481
This commit is contained in:
Robert Griesemer 2009-07-29 16:23:17 -07:00
parent c217c16a06
commit f9057c7b59
3 changed files with 16 additions and 1 deletions

View File

@ -681,7 +681,7 @@ func (p *printer) decl(decl ast.Decl) (comment *ast.CommentGroup, optSemi bool)
// Print the statement list indented, but without a newline after the last statement.
func (p *printer) stmtList(list []ast.Stmt) {
if len(list) > 0 {
p.print(+1, newline);
p.print(+1, formfeed); // the next lines have different structure
optSemi := false;
for i, s := range list {
if i > 0 {

View File

@ -50,3 +50,10 @@ func f1() {
/* 4 */
f0()
}
func abs(x int) int {
if x < 0 { // the tab printed before this comment's // must not affect the remaining lines
return -x // this statement should be properly indented
}
return x
}

View File

@ -50,3 +50,11 @@ func f1() {
/* 4 */
f0();
}
func abs(x int) int {
if x < 0 { // the tab printed before this comment's // must not affect the remaining lines
return -x; // this statement should be properly indented
}
return x;
}