Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic when using surround_replace/delete #9796

Merged
merged 1 commit into from
Mar 3, 2024

Commits on Mar 3, 2024

  1. Fix panic when using surround_replace/delete

    1. Create a document containing `{A}`
    1. C-w v # vsplit
    1. gl    # goto_line_end
    1. b     # move_prev_word_start
    1. `     # switch_to_lowercase
    1. mrm(  # surround replace
    1. C-w v # vsplit
    
    In the debug build surround_replace/delete will immedately assert with
    `assertion failed: last <= from', transaction.rs:597:13`. The splits and
    lowercase conversion are not needed to trigger the bug.
    
    In the release build the surround becomes `)a(` and the last vsplit
    causes the transaction to panic.
    `internal error: entered unreachable code:
    (Some(Retain(18446744073709551573)))', transaction.rs:185:46`
    
    Since the selection direction is backwards get_surround_pos returns the
    pairs reversed but the downstream code assumes they are in the forward
    direction.
    trink committed Mar 3, 2024
    Configuration menu
    Copy the full SHA
    611623c View commit details
    Browse the repository at this point in the history