private bool SelectLines() { EnvDTE.TextSelection ts = _dte.ActiveWindow.Selection as EnvDTE.TextSelection; if (ts.IsEmpty) { ts.SelectLine(); return(true); } else { int startLine = ts.AnchorPoint.Line; int endLine = ts.ActivePoint.Line; if (endLine < startLine) { int temp = startLine; startLine = endLine; endLine = temp; ts.SwapAnchor(); } ts.EndOfLine(true); int endChar = ts.ActivePoint.LineCharOffset; ts.GotoLine(startLine, true); ts.MoveToLineAndOffset(endLine, endChar, true); return(false); } }
private void SelectWord(EnvDTE.TextSelection ts) { if (!ts.IsEmpty) { return; } ts.WordLeft(true); ts.SwapAnchor(); ts.WordRight(true); }