Text Object Text replaced with script OK, but manual editing is bugged?

Clicking into text brings up “squished” text edit window instead of nice and long one and the warp checkbox is marked?..
Sometimes just clicking out fixes it and Warp checkbox isn’t marked anymore or stretching it to fit text horizontally fixes it also…

Check this out guys. This makes little to no sense.

Hi Asrterisk- please post the script, script result, and the incorrect result from a manual edit as a 3dm file, I’ll take a look.

-Pascal

This is the portion of the script that deals with text object text.

Tag=“NO-10-24”
counter=96
Rhino.TextObjectText Tag, Rhino.TextObjectText(Tag) & chr(13) & counter & " thus"

Output in text:
NO-10-24
96 thus

Symbols quantity script output: 16 symbols = 14 characters, 1 enter & 1 space (CORRECT)

As soon as I double click in text, click out of it not changing/editing anything and run symbols quantity script, its output is 17.
Visually nothing is changed on text object.

Text Object symbols quantity counter script:

Sub Main()

	Dim tag
	
	tag = Rhino.GetObject("Select text to count symbols qty", 512)
	If IsNull(tag) Then Exit Sub
	
	tag = Rhino.TextObjectText(tag)
	
	Rhino.Print Len(tag)

End Sub

The enter in your 2nd example is a combination of: chr(10) & chr(13)
The top one does not contain an enter. So it counts 16. If you want to count 17 you have to replcae your chr(13) with chr(10) & chr(13). Then it counts 17. if you want to count 16 you have to create something where you dont count chr(10) and chr(13).

Rhino.TextObjectText Tag, Rhino.TextObjectText(Tag) & chr(13) & chr(10) & counter & " thus"

Yep. I just “scanned” the lines with Asc() and it shows Chr(10) after chr(13).