Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
5a02eb65
Commit
5a02eb65
authored
Oct 28, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for long label names impacting column width of previous lines
R=rsc
http://go/go-review/1013017
parent
d2829faa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
printer.go
src/pkg/go/printer/printer.go
+6
-1
statements.go
src/pkg/go/printer/testdata/statements.go
+17
-0
statements.golden
src/pkg/go/printer/testdata/statements.golden
+17
-0
No files found.
src/pkg/go/printer/printer.go
View file @
5a02eb65
...
...
@@ -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
;
}
...
...
src/pkg/go/printer/testdata/statements.go
View file @
5a02eb65
...
...
@@ -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
;
}
src/pkg/go/printer/testdata/statements.golden
View file @
5a02eb65
...
...
@@ -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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment