Skip to content

Terminal sample is busted #516

Open
Open
@rjrjr

Description

@rjrjr

Launch it, type any character, crash:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 0, end 13, length 12
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
        at java.base/java.lang.String.substring(String.java:1874)
        at com.squareup.sample.hellotodo.EditTextWorkflowKt.insertCharAt(EditTextWorkflow.kt:100)
        at com.squareup.sample.hellotodo.EditTextWorkflowKt.access$insertCharAt(EditTextWorkflow.kt:1)
        at com.squareup.sample.hellotodo.EditTextWorkflow$onKeystroke$1.invoke(EditTextWorkflow.kt:72)
        at com.squareup.sample.hellotodo.EditTextWorkflow$onKeystroke$1.invoke(EditTextWorkflow.kt:68)

Arrow keys and return work okay, including return checking / unchecking items in the list.

If you arrow back a bit and type a few chars, they aren't echoed. Instead they act like the right arrow until you reach the end of the line and then you crash as above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions