aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-28 08:52:38 +0000
committerBlaž Hrastnik2021-06-28 08:52:57 +0000
commit6214d707f3aac89938441171cf7cc0d96517bbe5 (patch)
tree4d033b6eaa6ca2921c7806910bc6ec247eac5434 /helix-term
parentca98210d2016d96d1c441932d7a67bbc6e5eccb7 (diff)
fix: Don't panic on Enter on an empty document.
Refs #386
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 688e653a..f6511ba5 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2511,7 +2511,7 @@ pub mod insert {
} else {
contents.char(pos - 1)
};
- let curr = contents.char(pos);
+ let curr = contents.get_char(pos).unwrap_or(' ');
// TODO: offset range.head by 1? when calculating?
let indent_level = indent::suggested_indent_for_pos(