Skip to content

Commit

Permalink
fix: Panic when editing sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed May 5, 2024
1 parent 848a6f5 commit bdf55ec
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/tabs/editor/editor_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,29 +174,22 @@ pub fn EditorLine(
font_size: "{font_size}",
font_family: "Jetbrains Mono",
{line.iter().enumerate().map(|(i, (syntax_type, text))| {
match text {
let text = match text {
TextNode::Range(word_pos) => {
let text = rope.slice(word_pos.clone());
rsx!(
text {
key: "{i}",
color: "{syntax_type.color()}",
"{text}"
}
)

rope.slice(word_pos.clone()).to_string()
},
TextNode::LineOfChars { len, char } => {
let text = format!("{char}").repeat(*len);
rsx!(
text {
key: "{i}",
color: "{syntax_type.color()}",
"{text}"
}
)
format!("{char}").repeat(*len)
}
}
};

rsx!(
text {
key: "{i}",
color: "{syntax_type.color()}",
"{text}"
}
)
})}
}
}
Expand Down

0 comments on commit bdf55ec

Please sign in to comment.