Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
vim: Fix matching brackets with 1 offset in normal mode (#17396)
jjyc90ae3d90a16
diff --git a/crates/editor/src/highlight_matching_bracket.rs b/crates/editor/src/highlight_matching_bracket.rsindex 525d70f7470..5ddda65692e 100644--- a/crates/editor/src/highlight_matching_bracket.rs+++ b/crates/editor/src/highlight_matching_bracket.rs@@ -1,4 +1,5 @@use gpui::ViewContext;+use language::CursorShape;use crate::{Editor, RangeToAnchorExt};@@ -13,11 +14,18 @@ pub fn refresh_matching_bracket_highlights(editor: &mut Editor, cx: &mut ViewConreturn;}- let head = newest_selection.head();let snapshot = editor.snapshot(cx);+ let head = newest_selection.head();+ let mut tail = head;+ if (editor.cursor_shape == CursorShape::Block || editor.cursor_shape == CursorShape::Hollow)+ && head < snapshot.buffer_snapshot.len()+ {+ tail += 1;+ }+if let Some((opening_range, closing_range)) = snapshot.buffer_snapshot- .innermost_enclosing_bracket_ranges(head..head, None)+ .innermost_enclosing_bracket_ranges(head..tail, None){editor.highlight_background::<MatchingBracketHighlight>(&[