Move selection helpers to SelectionCollection, add update_anchor_selections, add a number of invariant preserving mutation functions to the MutableSelectionCollection
This commit is contained in:
parent
61b4a4202f
commit
c9dcfff607
22 changed files with 1891 additions and 1467 deletions
|
@ -57,7 +57,9 @@ pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
|||
if let Some(editor) = item.downcast::<Editor>() {
|
||||
editor.update(&mut cx, |editor, cx| {
|
||||
let len = editor.buffer().read(cx).read(cx).len();
|
||||
editor.select_ranges([len..len], Some(Autoscroll::Center), cx);
|
||||
editor.change_selections(true, cx, |s| {
|
||||
s.select_ranges([len..len], Some(Autoscroll::Center))
|
||||
});
|
||||
if len > 0 {
|
||||
editor.insert("\n\n", cx);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue