Implement text application using LineReaderAt

This is functionally equivalent to the previous version (except for one
error case), but uses the new interface. I think the code is simpler
overall because it removes the line tracking.
This commit is contained in:
Billy Keyes
2020-01-22 22:32:31 -08:00
parent f3702115a6
commit 0b7af3feaa
4 changed files with 92 additions and 100 deletions
+2 -2
View File
@@ -139,12 +139,12 @@ func (fl Line) String() string {
// Old returns true if the line appears in the old content of the fragment.
func (fl Line) Old() bool {
return fl.Op != OpAdd
return fl.Op == OpContext || fl.Op == OpDelete
}
// New returns true if the line appears in the new content of the fragment.
func (fl Line) New() bool {
return fl.Op == OpAdd
return fl.Op == OpContext || fl.Op == OpAdd
}
// NoEOL returns true if the line is missing a trailing newline character.