Skip to content

Commit

Permalink
Fix indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
kaleidawave committed Sep 29, 2023
1 parent 2a3689b commit 473c276
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ pub trait PathMap {

impl<T: PathMap> MapFileStore<T> {
pub fn update_file(&mut self, id: SourceId, content: String) {
self.sources[id.0 as usize].content = content;
self.sources[id.0 as usize - 1].content = content;
}

/// Returns the NEW length of the file's content
pub fn append_to_file(&mut self, id: SourceId, content: &str) -> usize {
let existing = &mut self.sources[id.0 as usize].content;
let existing = &mut self.sources[id.0 as usize - 1].content;
existing.push_str(content);
existing.len()
}
Expand All @@ -189,7 +189,7 @@ impl MapFileStore<WithPathMap> {
/// Either a rename or move
pub fn change_file_path(&mut self, from: &Path, to: PathBuf) {
let id = self.mappings.0[from];
self.sources[id.0 as usize].path = to;
self.sources[id.0 as usize - 1].path = to;
self.mappings.0.remove(from);
self.mappings.0.insert(from.to_path_buf(), id);
}
Expand Down

0 comments on commit 473c276

Please sign in to comment.