Commit 5a02eb65 authored by Robert Griesemer's avatar Robert Griesemer

fix for long label names impacting column width of previous lines

R=rsc
http://go/go-review/1013017
parent d2829faa
......@@ -418,7 +418,12 @@ func (p *printer) writeWhitespace(n int) {
// part of the comment whitespace prefix and the comment
// will be positioned correctly indented.
if i+1 < n && p.buffer[i+1] == unindent {
p.buffer[i], p.buffer[i+1] = unindent, ch;
// Use a formfeed to terminate the current section.
// Otherwise, a long label name on the next line leading
// to a wide column may increase the indentation column
// of lines before the label; effectively leading to wrong
// indentation.
p.buffer[i], p.buffer[i+1] = unindent, formfeed;
i--; // do it again
continue;
}
......
......@@ -156,3 +156,20 @@ func _() {
_ = 0;
}
}
func _() {
if {
_ = 0;
}
_ = 0; // the indentation here should not be affected by the long label name
AnOverlongLabel:
_ = 0;
if {
_ = 0;
}
_ = 0;
L: _ = 0;
}
......@@ -174,3 +174,20 @@ func _() {
_ = 0;
}
}
func _() {
if {
_ = 0;
}
_ = 0; // the indentation here should not be affected by the long label name
AnOverlongLabel:
_ = 0;
if {
_ = 0;
}
_ = 0;
L: _ = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment