Skip to content
This repository was archived by the owner on Jun 15, 2021. It is now read-only.
This repository was archived by the owner on Jun 15, 2021. It is now read-only.

crashing on saves #14

@DevinBayly

Description

@DevinBayly

There are two separate issues that cause crashes when saving a file with vixi.

1

event_controller/view.rs line 48


    pub fn lines_availables_after(&self, start: u32) -> u32 {
        (self.lines.len() as u32) - start
    }

start is frequently larger than what lines len gets set to when working with a file over 100 lines

2

same file line 172.


    pub fn update_buffer(&mut self, operations: Vec<Operation>) {
      .
      .
      .
      .

                        let old_buffer = &self.buffer.lines[old_idx + i];
                        new_buffer.lines.push(Line {
                            raw: old_buffer.raw.clone(),
                            ln: operation.ln.map(|ln| ln + i),
                            is_dirty,
                        });
                        new_idx += 1;
                    }

                    old_idx += operation.n;
                }

indexing into buffer.lines is often at a value too high for the actual length of the vector.

These issues seem related to something elsewhere that prevents the buffer from having an accurate count of its lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions