Skip to content

Assertion fails when using Alt-J on last line #5423

Description

@howard36

Summary

When the cursor is on the last line of a file (the very last line, which is always empty and has ~ as the line number) and Alt-J is pressed, Helix panics with the following error:

thread 'main' panicked at 'assertion failed: !ranges.is_empty()', helix-core/src/selection.rs:527:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction Steps

I tried this:

  1. hx
  2. j
  3. Alt-J

I expected this to happen:
No changes or edits.

Instead, this happened:
Helix panics with error

thread 'main' panicked at 'assertion failed: !ranges.is_empty()', helix-core/src/selection.rs:527:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Asciinema recording: https://asciinema.org/a/DMVeqQHNtvFWGxBvR7YrK7GMZ

Helix log

No new messages were logged in ~/.cache/helix/helix.log while performing the above steps.

Platform

Linux

Terminal Emulator

kitty 0.26.5

Helix Version

helix 22.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-helix-termArea: Helix term improvementsC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions