Index: src/pkg/go/token/position.go |
=================================================================== |
--- a/src/pkg/go/token/position.go |
+++ b/src/pkg/go/token/position.go |
@@ -136,6 +136,15 @@ |
f.set.mutex.Unlock() |
} |
+// RemoveLine removes a line by line number as reported by Position.Line. |
gri
2013/09/10 20:51:05
RemoveLine is slightly misleading a name.
This fu
josharian
2013/09/10 23:34:49
Agreed. I started with RemoveNewline, was unsure a
|
+// |
+func (f *File) RemoveLine(line int) { |
+ f.set.mutex.Lock() |
+ copy(f.lines[line:], f.lines[line+1:]) |
+ f.lines = f.lines[:len(f.lines)-1] |
+ f.set.mutex.Unlock() |
+} |
+ |
// SetLines sets the line offsets for a file and returns true if successful. |
// The line offsets are the offsets of the first character of each line; |
// for instance for the content "ab\nc\n" the line offsets are {0, 3}. |