Skip to content

Index out of bounds #2953

@ilsadq

Description

@ilsadq

Describe the bug
Index out of bounds

To Reproduce
Steps to reproduce the behavior:

  1. stage changes
  2. open Diff
  3. Press s (Unstage lines) i press on almost at the end of the buffer
  4. error

Error
GitUI was closed due to an unexpected panic.
Please file an issue on https://github.com/gitui-org/gitui/issues with the following info:

panicked at asyncgit/src/sync/staging/mod.rs:42:25:
index out of bounds: the len is 151 but the index is 151

trace:
0: backtrace::capture::Backtrace::new
1: gitui::set_panic_handler::{{closure}}
2: std::panicking::panic_with_hook
3: std::panicking::panic_handler::{{closure}}
4: std::sys::backtrace::__rust_end_short_backtrace
5: __rustc::rust_begin_unwind
6: core::panicking::panic_fmt
7: core::panicking::panic_bounds_check
8: asyncgit::sync::staging::NewFromOldContent::add_old_line
9: asyncgit::sync::staging::apply_selection
10: <gitui::components::diff::DiffComponent as gitui::components::Component>::event
11: gitui::components::event_pump
12: <gitui::tabs::status::Status as gitui::components::Component>::event
13: gitui::components::event_pump
14: gitui::run_app
15: gitui::main
16: std::sys::backtrace::__rust_begin_short_backtrace
17: _main

Context (please complete the following information):

  • macos 26.4.1
  • gitui 0.28.1-nightly 2026-03-24 ()
  • rustc 1.93.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions