mirror of https://github.com/golang/go.git
fix for long label names impacting column width of previous lines
R=rsc http://go/go-review/1013017
This commit is contained in:
parent
d2829faa7c
commit
5a02eb65ef
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue