Do not crash when inserting empty string
This commit is contained in:
parent
961b10d7b1
commit
25d04ace1c
1 changed files with 3 additions and 0 deletions
|
|
@ -206,6 +206,9 @@ impl<'a> Edit<'a> for Editor<'a> {
|
||||||
fn insert_string(&mut self, data: &str, attrs_list: Option<AttrsList>) {
|
fn insert_string(&mut self, data: &str, attrs_list: Option<AttrsList>) {
|
||||||
self.delete_selection();
|
self.delete_selection();
|
||||||
let mut remaining_split_len = data.len();
|
let mut remaining_split_len = data.len();
|
||||||
|
if remaining_split_len == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let line: &mut BufferLine = &mut self.buffer.lines[self.cursor.line];
|
let line: &mut BufferLine = &mut self.buffer.lines[self.cursor.line];
|
||||||
let insert_line = self.cursor.line + 1;
|
let insert_line = self.cursor.line + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue