Skip to content

Commit

Permalink
Fixed bug is some lines are selected partially and some whole (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
elvirbrk committed Feb 8, 2018
1 parent bc50ccf commit 8ae1f50
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion NoteHighlightAddin/AddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,18 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High
{
if (isInline)
{
outline.Descendants(ns + "T").Where(n => n.Attribute("selected") != null && n.Attribute("selected").Value == "all").FirstOrDefault().ReplaceWith(children.Descendants(ns + "Table").Descendants(ns+"OEChildren").Descendants(ns + "OE").Descendants(ns + "T").FirstOrDefault());
int j = 0;
for(int i = 0; i < outline.Descendants(ns + "OE").Count(); i++)
{
XElement oeNode = outline.Descendants(ns + "OE").ElementAt(i);

if (oeNode.Descendants(ns + "T").Where(n => n.Attribute("selected") != null && n.Attribute("selected").Value == "all").Count() > 0)
{
oeNode.Descendants(ns + "T").Where(n => n.Attribute("selected") != null && n.Attribute("selected").Value == "all").FirstOrDefault().ReplaceWith(children.Descendants(ns + "Table").Descendants(ns + "OEChildren").Descendants(ns + "OE").ElementAt(j).Descendants(ns + "T"));
j++;
}

}
outline.Descendants(ns + "OE").Where(t => t.Elements(ns + "T").Any(n => n.Attribute("selected") != null && n.Attribute("selected").Value == "all")).Remove();
}
else
Expand Down

0 comments on commit 8ae1f50

Please sign in to comment.