Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice

This commit is contained in:
Keith Simmons 2022-05-13 16:58:30 -07:00
parent 2f7eb6dbc5
commit a2fd41174f
9 changed files with 36 additions and 17 deletions

View file

@ -56,7 +56,7 @@ pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
if let Some(Some(Ok(item))) = opened.first() {
if let Some(editor) = item.downcast::<Editor>() {
editor.update(&mut cx, |editor, cx| {
let len = editor.buffer().read(cx).read(cx).len();
let len = editor.buffer().read(cx).len(cx);
editor.change_selections(Some(Autoscroll::Center), cx, |s| {
s.select_ranges([len..len])
});