Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Improve recovering state from an attribute end position.
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillOsenkov committed May 23, 2020
1 parent 3784c36 commit 8db330a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Core/Dom/XmlDomExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ static XAttribute FindAttribute (this IAttributedXObject attContainer, int offse
if (att.Span.Start > offset) {
break;
}
if (att.Span.Contains (offset)) {
// If the position touches the end of the attribute, we still want to include the attribute
if (att.Span.ContainsOuter (offset)) {
return att;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Parser/XmlTagState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public override XmlParserContext TryRecreateState (XObject xobject, int position
newEl.Attributes.AddAttribute ((XAttribute)att.ShallowCopy ());
continue;
}
if (att.Span.End > position) {
if (att.Span.End >= position) {
position = att.Span.Start;
break;
}
Expand Down

0 comments on commit 8db330a

Please sign in to comment.