diff --git a/crates/nu-protocol/src/dataframe/compute_between.rs b/crates/nu-protocol/src/dataframe/compute_between.rs index 627b71eaf8..fa5e02849a 100644 --- a/crates/nu-protocol/src/dataframe/compute_between.rs +++ b/crates/nu-protocol/src/dataframe/compute_between.rs @@ -21,7 +21,7 @@ pub fn compute_between_dataframes( if let (UntaggedValue::DataFrame(lhs), UntaggedValue::DataFrame(rhs)) = (&left.value, &right.value) { - let operation_span = left.tag.span.until(right.tag.span); + let operation_span = right.tag.span.merge(left.tag.span); match (lhs.is_series(), rhs.is_series()) { (true, true) => { let lhs = &lhs diff --git a/crates/nu-source/src/meta.rs b/crates/nu-source/src/meta.rs index 6fb0fa10c7..c2a4dda355 100644 --- a/crates/nu-source/src/meta.rs +++ b/crates/nu-source/src/meta.rs @@ -605,6 +605,16 @@ impl Span { Span::new(self.start, other.end) } + pub fn merge(&self, other: impl Into) -> Span { + let other = other.into(); + + if other.end < self.start { + other.until(self) + } else { + self.until(other) + } + } + /// Returns a new Span by merging a later Span with the current Span. /// /// If the given Span is of the None variant,