Use attributes at cursor position for insertions in Editor
This commit is contained in:
parent
cb83458e7d
commit
0bb02227de
1 changed files with 6 additions and 2 deletions
|
|
@ -235,8 +235,12 @@ impl Edit for Editor {
|
|||
let after_len = after.text().len();
|
||||
|
||||
// Collect attributes
|
||||
let mut final_attrs = attrs_list
|
||||
.unwrap_or_else(|| AttrsList::new(line.attrs_list().get_span(line.text().len())));
|
||||
let mut final_attrs = attrs_list.unwrap_or_else(|| {
|
||||
AttrsList::new(
|
||||
line.attrs_list()
|
||||
.get_span(self.cursor.index.saturating_sub(1)),
|
||||
)
|
||||
});
|
||||
|
||||
// Append the inserted text, line by line
|
||||
// we want to see a blank entry if the string ends with a newline
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue