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

Resizing a bunch causes index out of bounds #69

Closed
Kethku opened this issue Jun 2, 2021 · 13 comments
Closed

Resizing a bunch causes index out of bounds #69

Kethku opened this issue Jun 2, 2021 · 13 comments
Labels
C-bug Category: This is a bug

Comments

@Kethku
Copy link
Contributor

Kethku commented Jun 2, 2021

image

@IceDragon200
Copy link
Contributor

Was that with or without actual content in the buffer?

@Kethku
Copy link
Contributor Author

Kethku commented Jun 2, 2021

crashes reliably with or without.

@RLHerbert
Copy link
Contributor

I get the (exact, as far as I can tell) same crash when repeating an insert with "."

@Kethku
Copy link
Contributor Author

Kethku commented Jun 2, 2021

I can't repro that. Both going into insert mode and holding '.' and leaving insert mode and repeating that insert by holding '.' from normal mode do not reproduce the problem for me.

@RLHerbert
Copy link
Contributor

I get the (exact, as far as I can tell) same crash when repeating an insert with "."

Actually, I get a number slightly smaller than u16::MAX for the index.

I can't repro that. Both going into insert mode and holding '.' and leaving insert mode and repeating that insert by holding '.' from normal mode do not reproduce the problem for me.

Sorry, meant replace, not insert.

@Kethku
Copy link
Contributor Author

Kethku commented Jun 2, 2021

I don't understand. Do you have a minimal set of keystrokes that repro?

@IceDragon200
Copy link
Contributor

Strange I couldn't reproduce either problems, I use arch linux and and i3wm

@Kethku
Copy link
Contributor Author

Kethku commented Jun 2, 2021

My issue is from windows. Is there a way to log terminal events out?

@RLHerbert
Copy link
Contributor

RLHerbert commented Jun 2, 2021

Open file -> shift+r -> "asd" -> normal mode -> '.' ~10-20 times.

Seems to depend Definitely depends on the length of the buffer at the time.

On WSL Ubuntu.

@RLHerbert
Copy link
Contributor

Actually, I get a number slightly smaller than u16::MAX for the index.

❯ RUST_BACKTRACE=1 hx src/main.rs
thread 'main' panicked at 'index out of bounds: the len is 4992 but the index is 65523', helix-tui/src/buffer.rs:185:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/625d5a693e4697bcafdd34fd1a38c281acabb8e9/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/625d5a693e4697bcafdd34fd1a38c281acabb8e9/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/625d5a693e4697bcafdd34fd1a38c281acabb8e9/library/core/src/panicking.rs:69:5
   3: helix_tui::buffer::Buffer::set_style
   4: <hx::ui::editor::EditorView as hx::compositor::Component>::render
   5: hx::compositor::Compositor::render
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: tokio::park::thread::CachedParkThread::block_on
   8: tokio::runtime::thread_pool::ThreadPool::block_on
   9: tokio::runtime::Runtime::block_on
  10: hx::main

@IceDragon200
Copy link
Contributor

IceDragon200 commented Jun 2, 2021

I got something similar:

thread 'main' panicked at 'attempt to subtract with overflow', helix-view/src/view.rs:147:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I was running it in dev

And then once again with the 0.0.8 release:

λ kana helix → λ git replaced-args-parser* → hx
thread 'main' panicked at 'index out of bounds: the len is 10670 but the index is 65534', helix-tui/src/buffer.rs:185:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

hx > shift+r > asd > esc > i > . as many times until it crashes

@IceDragon200 IceDragon200 added the C-bug Category: This is a bug label Jun 2, 2021
@RLHerbert
Copy link
Contributor

RLHerbert commented Jun 2, 2021

Well, it's not shift+r, it's just 'a'/insert after selection. It actually doesn't seem to have to do with repeat at all. I'm getting this bug whenever the buffer length hits about 93 characters exceeds the terminal width.

Built from master.

Edit: Also occurs on resizing window when buffer length is larger than the new window size.

@archseer
Copy link
Member

archseer commented Jun 3, 2021

If rapidly resizing the terminal, the view tree's sizing would fall out of sync and point out of bounds. c0332bd together with #70 should fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants