diff options
author | Blaž Hrastnik | 2021-06-28 08:52:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-28 08:52:57 +0000 |
commit | 6214d707f3aac89938441171cf7cc0d96517bbe5 (patch) | |
tree | 4d033b6eaa6ca2921c7806910bc6ec247eac5434 /helix-term | |
parent | ca98210d2016d96d1c441932d7a67bbc6e5eccb7 (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.rs | 2 |
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( |