Implemented Get/Set Caret and Insert

git-svn-id: svn://10.0.0.236/trunk@5058 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods
1998-07-06 21:31:01 +00:00
parent 8741f5374c
commit e6aa541d3e

View File

@@ -61,8 +61,12 @@ PRUint32 nsTextHelper::SetText(const nsString &aText)
PRUint32 nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos)
{
// NOT IMPLEMENTED
return(0);
nsString currentText;
GetText(currentText, 256);
nsString newText(aText);
currentText.Insert(newText, aStartPos, aText.Length());
SetText(currentText);
return(aText.Length());
}
void nsTextHelper::RemoveText()
@@ -102,11 +106,18 @@ void nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
void nsTextHelper::SetCaretPosition(PRUint32 aPosition)
{
SetSelection(aPosition, aPosition);
}
PRUint32 nsTextHelper::GetCaretPosition()
{
return(0);
PRUint32 start;
PRUint32 end;
GetSelection(&start, &end);
if (start == end) {
return start;
}
return -1;
}
//-------------------------------------------------------------------------