Skip to content

Uncaught TypeError: can't access property "substring", u[n] is undefined OR Cannot read properties of undefined (reading 'substring') #1026

@leeharr

Description

@leeharr

Issue summary

When using command history (up-arrow to retrieve previously typed commands)
A line that perfectly fits in the line (such that the cursor for the next-typed letter is on the next line)
Pressing up-arrow to retrieve lines previous to the long entry fail, throwing this error:

On Chrome:

Uncaught TypeError: Cannot read properties of undefined (reading 'substring')
de	@	jquery.terminal.js:2842
at	@	jquery.terminal.js:4338
dispatch	@	jquery:2
v.handle	@	jquery:2

On Firefox:

Uncaught TypeError: can't access property "substring", u[n] is undefined
    jQuery 4
        de
        at
        dispatch
        handle

Expected behavior

Retrieve any previously typed commands, no matter what length.

Steps to reproduce

Error is present on the codepen default
(https://codepen.io/pen?template=MbVMwO)

Enter a short line, press Enter to put it into history
Enter a line that fits exactly into the length of the line available in the terminal.
(cursor for the next-typed character should be on the 2nd line)
Press Enter to put long line into the history
Press up-arrow. (Long line appears from history)
Press up-arrow again (Error)
(Short line typed first is not retrievable from history)

Browser and OS

Debian Linux
Firefox 140.3.1esr
Chrome 141.0.7390.65

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions