iOS Question Problem with multiple returns in textView

pliroforikos

Active Member
Licensed User
Hello,
I have a strange problem with textView. I made a simple program to demostrate it. Here is the code:
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private TextView1 As TextView
End Sub

Public Sub Initialize
'    B4XPages.GetManager.LogEvents = True
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub Button1_Click
    Log(TextView1.Text)
    Log("=====")
End Sub

I made a simple form with one button and one textView. The problem occurs when a press return many times in textView. The log file shows strange characters and in case of 4 or more returns it crashes with the bellow message.
Error occurred on line: 27 (B4XMainPage)
-[__NSCFString deleteCharactersInRange:]: Range or index out of bounds
Stack Trace: (
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 38040
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 1672224
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 1205976
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 807216
textView -[B4IShellConnector Log::] + 548
textView -[B4I addLogPrefix::] + 248
textView -[B4ICommon LogImpl:::] + 544
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 450496
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 127560
textView +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296
textView -[B4IShell runVoidMethod] + 208
textView -[B4IShell raiseEventImpl:method:args::] + 1608
textView -[B4IShellBI raiseEvent:event:params:] + 1360
textView __33-[B4I raiseUIEvent:event:params:]_block_invoke + 52
libdispatch.dylib E389E46D-7BDA-33A1-9CF3-D8E5CC909C38 + 407464
libdispatch.dylib E389E46D-7BDA-33A1-9CF3-D8E5CC909C38 + 411520
libdispatch.dylib E389E46D-7BDA-33A1-9CF3-D8E5CC909C38 + 286224
libdispatch.dylib E389E46D-7BDA-33A1-9CF3-D8E5CC909C38 + 285320
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 596524
CoreFoundation 48524CDA-8D0D-3EAC-A286-69AE36B87031 + 480968
CoreFoundation CFRunLoopRunSpecific + 584
GraphicsServices GSEventRunModal + 160
UIKitCore 7CA2102B-17DC-3183-B7C0-6FC645514C0E + 3610636
UIKitCore UIApplicationMain + 312
textView main + 100
dyld D64B17E5-D3AD-3FEA-A25A-579091848AB9 + 82756
)

I took some photos of the behavior .
In img1 and img2 everything is fine. In img3 something change and in img4 worst. With 4 or more returns it crashes.

Any ideas?
 

Attachments

  • img1.jpg
    img1.jpg
    31.4 KB · Views: 37
  • img2.jpg
    img2.jpg
    34.5 KB · Views: 44
  • img3.jpg
    img3.jpg
    33.9 KB · Views: 33
  • img4.jpg
    img4.jpg
    34.4 KB · Views: 38
  • Project.zip
    8.6 KB · Views: 26
Top