Skip to content

Commit

Permalink
fix a pad crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 21, 2024
1 parent dcfbe9e commit bf3e51a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion site/src/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ pub fn Editor<'a>(
let (line, col) = line_col(&code, end as usize);
let line_index = line - 1;
let up = key == "ArrowUp";
let mut lines: Vec<String> = code.lines().map(Into::into).collect();
let mut lines: Vec<String> = code.split('\n').map(Into::into).collect();
if up && line_index > 0 || !up && line_index < lines.len() - 1 {
let swap_index = if up { line_index - 1 } else { line_index + 1 };
lines.swap(line_index, swap_index);
Expand Down

0 comments on commit bf3e51a

Please sign in to comment.