Skip to content

Panic in alternate screen when passing empty word list #149

@SimonRenblad

Description

@SimonRenblad

Passing an empty word list, either directly or piped through stdin, fails at:

thread 'main' panicked at src/ui.rs:97:35: index out of bounds: the len is 0 but the index is 0

Which would be fine, except for it remaining on the alternate screen, so I need to tput rmcup to get out.

I understand that this is not a typical problem when reading directly from a file, but I tend to pipe inputs into ttyper and whenever a previous command in the pipeline fails I get this error.

I would propose to check the length of contents before enabling raw mode in main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions