Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Do not autoindent on line removals in vim mode. (#9332)
Piotr Osiewiczb795b0eb77f4
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 1db383e6ebf..aa1081e5097 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -101,6 +101,7 @@ use serde::{Deserialize, Serialize};use settings::{Settings, SettingsStore};use smallvec::SmallVec;use snippet::Snippet;+use std::ops::Not as _;use std::{any::TypeId,borrow::Cow,@@ -2951,13 +2952,10 @@ impl Editor {}pub fn insert(&mut self, text: &str, cx: &mut ViewContext<Self>) {- self.insert_with_autoindent_mode(- text,- Some(AutoindentMode::Block {- original_indent_columns: Vec::new(),- }),- cx,- );+ let autoindent = text.is_empty().not().then(|| AutoindentMode::Block {+ original_indent_columns: Vec::new(),+ });+ self.insert_with_autoindent_mode(text, autoindent, cx);}fn insert_with_autoindent_mode(