From e6aa541d3ec0ce3f669d6efcb339a3d69bb31e49 Mon Sep 17 00:00:00 2001 From: rods Date: Mon, 6 Jul 1998 21:31:01 +0000 Subject: [PATCH] Implemented Get/Set Caret and Insert git-svn-id: svn://10.0.0.236/trunk@5058 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsTextHelper.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mozilla/widget/src/windows/nsTextHelper.cpp b/mozilla/widget/src/windows/nsTextHelper.cpp index 6da230b5c53..0a162bc0049 100644 --- a/mozilla/widget/src/windows/nsTextHelper.cpp +++ b/mozilla/widget/src/windows/nsTextHelper.cpp @@ -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; } //-------------------------------------------------------------------------