+// SaveString returns the string that should be written to disk when
+// the line array is saved
+// It is the same as string but uses crlf or lf line endings depending
+func (la *LineArray) SaveString(useCrlf bool) string {
+ str := ""
+ for i, l := range la.lines {
+ str += string(l.data)
+ if i != len(la.lines)-1 {
+ if useCrlf {
+ str += "\r"
+ }
+ str += "\n"
+ }
+ }
+ return str
+}
+