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

iota crashes after C-A/C-E when the buffer is only one line #100

Open
snowp opened this issue Apr 14, 2015 · 4 comments
Open

iota crashes after C-A/C-E when the buffer is only one line #100

snowp opened this issue Apr 14, 2015 · 4 comments
Labels

Comments

@snowp
Copy link

snowp commented Apr 14, 2015

The editor crashes due to a rust_panic caused by an out of bounds access on a Vec whenever move-beginning-of-line (C-a) or move-end-of-line (C-e) is used in a buffer with no newlines.

thread '<main>' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcollections/vec.rs:1346

The issue seems to be with buffer.rs in get_line_index_backward and get_line_index_forward: nlines is an empty Vec when the buffer contains no newlines. The subsequent access to nlines[offset] on line 275 and 334 causes the panics.

@gchp
Copy link
Owner

gchp commented Apr 17, 2015

Thanks for the report! Will try get this fixed asap!

@gchp gchp added the bug label Apr 17, 2015
@romanlevin
Copy link

This doesn't crash anymore, however C-e does nothing at all when you are on a line without a newline at the end of it.

@crespyl
Copy link
Contributor

crespyl commented Mar 9, 2016

I have a partial fix here.

The cursor seems to get displayed one char after where it should be, but the actual insertion point is correct.

@gchp
Copy link
Owner

gchp commented Mar 10, 2016

@crespyl looks good!

Wanna open a pull request? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants