private void UpdatSelectionPoint(SelectionPoint pt) { if (pt != null && this.Properties.FormatCharacters != null) { if (pt != null && this.Properties.FormatCharacters != null) { var temp = pt; pt = null; if (temp.Start != -1) { if (temp.End != -1) { var positionToSet = this.GetPosition(this.BeginningOfDocument, temp.Start); this.SelectedTextRange = this.GetTextRange(positionToSet, positionToSet); } else { if (temp.Start >= this.Text.Length) { temp.Start = this.Text.Length; } else { var before = this.BeforeChars; if (before == "") { temp.Start = 1; } else { var text = this.Text; for (int i = 0; i < text.Length; i++) { string c = text[i].ToString(); if (this.Properties.FormatCharacters.Where(ch => ch.ToString() == c.ToString()).Count() <= 0) { // no placeholder1 if (before[0].ToString() == c) { before = before.Substring(1); } if (String.IsNullOrEmpty(before)) { temp.Start = i + 1; break; } } } } } var positionToSet = this.GetPosition(this.BeginningOfDocument, temp.Start); this.SelectedTextRange = this.GetTextRange(positionToSet, positionToSet); } } } this.Locked = false; } }
private void UpdatSelectionPoint(SelectionPoint pt) { if (pt != null && this.Properties.FormatCharacters != null) { if (pt != null && this.Properties.FormatCharacters != null) { var temp = pt; pt = null; if (temp.Start != -1) { if (temp.End != -1) { var positionToSet = this.GetPosition (this.BeginningOfDocument, temp.Start); this.SelectedTextRange = this.GetTextRange (positionToSet, positionToSet); } else { if (temp.Start >= this.Text.Length) { temp.Start = this.Text.Length; } else { var before = this.BeforeChars; if (before == "") { temp.Start = 1; } else { var text = this.Text; for (int i = 0; i < text.Length; i++) { string c = text[i].ToString(); if (this.Properties.FormatCharacters.Where(ch => ch.ToString() == c.ToString()).Count() <= 0) { // no placeholder1 if (before[0].ToString() == c) { before = before.Substring(1); } if (String.IsNullOrEmpty(before)) { temp.Start = i+1; break; } } } } } var positionToSet = this.GetPosition (this.BeginningOfDocument, temp.Start); this.SelectedTextRange = this.GetTextRange (positionToSet, positionToSet); } } } this.Locked = false; } }