mirror of
https://github.com/nushell/nushell.git
synced 2024-11-30 04:14:17 +01:00
merge span (#4031)
This commit is contained in:
parent
59697cab63
commit
962b258cc6
@ -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
|
||||
|
@ -605,6 +605,16 @@ impl Span {
|
||||
Span::new(self.start, other.end)
|
||||
}
|
||||
|
||||
pub fn merge(&self, other: impl Into<Span>) -> 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,
|
||||
|
Loading…
Reference in New Issue
Block a user