HOW CAN I IMPLEMENT "SMART SELECTION ON DOUBLE-CLICK" FOR HTML?

For example, we have following html:

I setting caret near first "e" letter in class attribute value, and double-clicking.
At first double-click, I want such selection:

At second double-click, I want such selection:

At third double-click - just remove all selection.
...Or, alternatively, just selection of WHOLE attribute value on 1st double-click, but not only before/after "-" symbol.
And same for attribute names: if it is "data-id", there is no use to select only "data" or only "id", it should be selected as "data-id".
Hi
In order to select word containing "-" you will just need to exclude it from the delimiter set with code like this:
Lines.Delimiters = @";.,:'""{}[]()?!@#$%^&*+=|\/<>".ToCharArray();
For handling multiple double-clicks you might need to analyse that the text being selected contains full argument. It can be done, but it looks like handling tripple click might be a better choice here.
So on double click it will select current word, on tripple click - whole argument.
Below is a code snippet.
public class MyEditor : SyntaxEdit
{
public class MySelection : Selection
{
public MySelection(ISyntaxEdit owner) :
base(owner)
{
}
private bool GetWord(int index, int pos, out int left, out int right)
{
left = 0;
right = 0;
string s = (Owner.Lines != null) && (Owner.Lines.Count > index) && (index >= 0) ? Owner.Lines[index] : string.Empty;
int len = s.Length;
var parser = Owner.Lexer as ISyntaxParser;
if (parser != null)
{
ISyntaxNode node = parser.GetNodeAt(new Point(pos, index));
if ((node != null) && (node.NodeType == (int)XmlNodeType.XmlParameter))
{
ISyntaxAttribute attr = node.FindAttribute(XmlNodeType.XmlParameter.ToString());
if ((attr != null) && (attr.Range.StartPoint.X <= pos) && (attr.Range.EndPoint.X >= pos))
{
left = Math.Min(len, attr.Range.StartPoint.X + 1);
right = Math.Max(0, attr.Range.EndPoint.X - 2);
return true;
}
}
}
return false;
}
protected bool SelectArgument()
{
int left;
int right;
ITextStrings lines = Owner.Lines;
Point pt = Owner.Position;
string s = Owner.Lines[pt.Y];
if ((pt.X > 0) && (pt.X < s.Length) && ((Owner.Lines.IsDelimiter(s, pt.X) && !Owner.Lines.IsDelimiter(s, pt.X - 1)) || (Owner.Lines.IsWhitespace(s, pt.X) && !Owner.Lines.IsWhitespace(s, pt.X - 1))))
pt.X--;
bool result = GetWord(pt.Y, pt.X, out left, out right);

if (result)
{
Owner.MoveTo(right + 1, pt.Y);
SelStart = new Point(left, pt.Y);
SetSelection(SelectionType.Stream, new Rectangle(left, pt.Y, right - left + 1, 0));
}
return result;
}
public override void SelectLine()
{
if (!SelectArgument())
base.SelectLine();
}
}
public MyEditor()
{
Lines.Delimiters = @";.,:'""{}[]()?!@#$%^&*+=|\/<>".ToCharArray();
}
protected override ISelection CreateSelection()
{
return new MySelection(this);
}
}
reragds,
Andrew