From 580ace24ad1b735c97f4c04feabc3e356026c98b Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 16 Dec 2010 20:43:20 +0000 Subject: [PATCH] Added logic so that when a link appears at the beginning of a line, and the cursor is moved to the beginning of the line, the link is selected rather than positioning the cursor at the end of the previous line. --- PROMS/Volian.Controls.Library/StepRTB.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 42ac134e..ef094604 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -1128,8 +1128,15 @@ namespace Volian.Controls.Library { if (SelectionStart >= 7) { - DebugPrint("HSC===================>ll Insert: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, ll.Start, ll.Length); - SelectionStart = ll.Start - 7; + // If the cursor is at the beginning of the line and a link is at the beginning of the line + // then select the link rather than postitioning the cursor at the end of the previous line + if (GetFirstCharIndexOfCurrentLine() == SelectionStart) + SetSelection(ll); + else + { + DebugPrint("HSC===================>ll Insert: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, ll.Start, ll.Length); + SelectionStart = ll.Start - 7; + } } } else if (SelectionStart + SelectionLength > ll.End) // Beyond the end of the starting link