Preserve item helper history in source order
This commit is contained in:
@@ -125,8 +125,8 @@ func applicationOperationPath(application historyApplication, query Path, lookup
|
||||
if !application.path.valid() || application.value == nil {
|
||||
return Path{}, false
|
||||
}
|
||||
if application.path.String() != "" {
|
||||
if pathsIntersect(application.path, query) {
|
||||
if !pathContains(application.path, query) {
|
||||
if pathContains(query, application.path) {
|
||||
return application.path.clone(), true
|
||||
}
|
||||
return Path{}, false
|
||||
@@ -148,17 +148,18 @@ func applicationOperationPath(application historyApplication, query Path, lookup
|
||||
if sequencePathMatched {
|
||||
return Path{}, false
|
||||
}
|
||||
if len(query.segments) == 0 {
|
||||
return Path{}, true
|
||||
if len(query.segments) == len(application.path.segments) || application.value.Kind != document.Mapping {
|
||||
return application.path.clone(), true
|
||||
}
|
||||
for length := 1; length <= len(query.segments); length++ {
|
||||
prefix := Path{segments: clonePathSegments(query.segments[:length], 0)}
|
||||
relative, _ := relativeHistoryPath(application.path, query)
|
||||
for length := 1; length <= len(relative.segments); length++ {
|
||||
prefix := Path{segments: clonePathSegments(relative.segments[:length], 0)}
|
||||
node, present := documentAtPathWithLookup(application.value, prefix, lookup)
|
||||
if !present {
|
||||
return Path{}, false
|
||||
}
|
||||
if length == len(query.segments) || node.Kind != document.Mapping {
|
||||
return prefix, true
|
||||
if length == len(relative.segments) || node.Kind != document.Mapping {
|
||||
return appendDestination(application.path, prefix), true
|
||||
}
|
||||
}
|
||||
return Path{}, false
|
||||
|
||||
Reference in New Issue
Block a user