+// PadLeft returns a Variant that is equivalent to v but (if possible)
+// uses the stashed preceding base (the Left field) to avoid having a
+// non-empty Ref or New part, even for an insertion or deletion.
+//
+// For example, if v is {Position: 45, Ref: "", New: "A"}, PadLeft
+// might return {Position: 44, Ref: "T", New: "TA"}.
+func (v *Variant) PadLeft() Variant {
+ if len(v.Ref) == 0 || len(v.New) == 0 {
+ return Variant{
+ Position: v.Position - len(v.Left),
+ Ref: v.Left + v.Ref,
+ New: v.Left + v.New,
+ }
+ } else {
+ return *v
+ }
+}
+