Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
src/pkg/go/printer/printer.go
src/pkg/go/printer/printer.go
+6
-1
src/pkg/go/printer/testdata/statements.go
src/pkg/go/printer/testdata/statements.go
+17
-0
src/pkg/go/printer/testdata/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