private String getPreviousPara()
{
int index = TextBoxTalkWindow.SelectionStart;
var text = TextBoxTalkWindow.Text;
if (text.Length == 0)
{
return String.Empty;
}
if (index >= text.Length)
{
index = text.Length - 1;
}
while (index > 0 && (text[index] == '\r' || text[index] == '\n'))
{
index--;
}
int endPos = index;
while (index > 0 && text[index] != '\r' && text[index] != '\n')
{
index--;
}
if (index > 0 && (text[index] == '\r' || text[index] == '\n'))
{
index++;
}
int startPos = index;
return text.Substring(startPos, endPos - startPos + 1);
}