We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

InsertText(String, Int32, Int32) only updates first line of String into EditControl.Text

I am trying to implement drag and drop from a wpf tree control into the current cursor position in Syncfusion EditControl. I am handling the Drop event with:

privatevoid textEditor_Drop(object sender,DragEventArgs e)
{
textEditor.InsertText(e.Data.GetData("Text").ToString(), textEditor.LineNumber, textEditor.CursorIndex);
MessageBox.Show(textEditor.Text,"Title");
}

The result is shown in this screenshot:

editcontrolissue.png

As you can see, the message box called immediately after the InsertText() only contains the first line of the pasted text (which uses "\ n" characters for new lines, but I tried "\r" too with the same issue). 

Yet the edit control has rendered the dropped text correctly.

If I manually edit the text and then do a MessageBox.Show(textEditor.Text, "Title") the full, multi-line text shows.

Is this a bug or am I implementing the InsertText() call incorrectly / missing an additional call to resolve the issue?

Many thanks!




6 Replies 1 reply marked as answer

PE Peter January 3, 2023 07:12 PM UTC

OP here. The issue actually has nothing to do with drag and drop. You get the same issue whenever you insert multiline text into the control.

I added a wpf button and an event handler, which has the same issue as described in my original post:



        private void deleteme_Click(object sender, RoutedEventArgs e)
{
textEditor.InsertText("SELECT * <newline> from<newline>mytable<newline>", textEditor.LineNumber, textEditor.CursorIndex);
}

Please substitute forward-slash n for <newline> in the code - the web editor seems to fail to render a typed forward-slash n newline character!



KA Karthick Arjunan Syncfusion Team January 3, 2023 07:14 PM UTC

Hi Peter,


We were able to reproduce the reported issue at our end. We will validate and provide the complete details within two business days.



KA Karthick Arjunan Syncfusion Team January 5, 2023 04:03 PM UTC

Hi Peter,


We have confirmed the “InsertText(String, Int32, Int32) only updates first line of String into EditControl.Text” as an issue. We will include the fix for the reported issue in our upcoming weekly NuGet release which is expected to roll out on January 10 2023. We appreciate your patience until then. We will let you know once it gets rolled out.



PE Peter January 5, 2023 04:32 PM UTC

Hi Karthick,

That's fantastic, thank you!

All the best,

Pete



KA Karthick Arjunan Syncfusion Team January 10, 2023 12:57 PM UTC

Hi Peter,

We are glad to announce that our weekly nuget release was rolled out and a fix for the reported issue was included in the NuGet.

v20.4.0.43

NuGet Link: https://www.nuget.org/

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Marked as answer

PE Peter January 10, 2023 02:43 PM UTC

Thank you Karthick.  Yes, I have just updated to the new release and am very happy to confirm that the fix is successful!


Loader.
Live Chat Icon For mobile
Up arrow icon