review: rebuild a file the mesh once wrote whole, keep links, give back a missing line end, and release a hold only after the write (hq issue 128)
This commit is contained in:
@@ -169,6 +169,9 @@ type File struct {
|
||||
// the operator all write into it, and the mesh writing it whole took their lines away at the
|
||||
// next change to the mesh's names, silently. Marked blocks are the shape the other tools in
|
||||
// that file already use, and `#` is the comment character of every file this serves.
|
||||
//
|
||||
// Written into, in either format, the file's mode and owner are the machine's: a declared mode
|
||||
// and owner apply only to a file the host creates, and a file that was there keeps its own.
|
||||
Into string `json:"into,omitempty"`
|
||||
|
||||
// At is where a file written into a block has its region added when the file does not hold
|
||||
@@ -272,10 +275,15 @@ func (f *File) validate(where string, _ bool) []string {
|
||||
break
|
||||
}
|
||||
}
|
||||
// The id is written into the markers, so it has to stay on one line.
|
||||
// The id is written into the markers, so it has to stay on one line — and whitespace at
|
||||
// either end of it is whitespace the host would have to match exactly in a line some
|
||||
// editor may trim.
|
||||
if strings.ContainsAny(f.ID, "\r\n") {
|
||||
problems = append(problems, where+
|
||||
": a file written into a block names its region by its id, and this id spans lines")
|
||||
} else if strings.TrimSpace(f.ID) != f.ID {
|
||||
problems = append(problems, where+
|
||||
": a file written into a block names its region by its id, and this id begins or ends in whitespace")
|
||||
}
|
||||
default:
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
|
||||
Reference in New Issue
Block a user