mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 12:19:28 +00:00
vim: Fix matching brackets with 1 offset in normal mode (#17396)
Closes #17342 Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
f91bf7fca5
commit
c90ae3d90a
1 changed files with 10 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
use gpui::ViewContext;
|
use gpui::ViewContext;
|
||||||
|
use language::CursorShape;
|
||||||
|
|
||||||
use crate::{Editor, RangeToAnchorExt};
|
use crate::{Editor, RangeToAnchorExt};
|
||||||
|
|
||||||
|
@ -13,11 +14,18 @@ pub fn refresh_matching_bracket_highlights(editor: &mut Editor, cx: &mut ViewCon
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let head = newest_selection.head();
|
|
||||||
let snapshot = editor.snapshot(cx);
|
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
|
if let Some((opening_range, closing_range)) = snapshot
|
||||||
.buffer_snapshot
|
.buffer_snapshot
|
||||||
.innermost_enclosing_bracket_ranges(head..head, None)
|
.innermost_enclosing_bracket_ranges(head..tail, None)
|
||||||
{
|
{
|
||||||
editor.highlight_background::<MatchingBracketHighlight>(
|
editor.highlight_background::<MatchingBracketHighlight>(
|
||||||
&[
|
&[
|
||||||
|
|
Loading…
Reference in a new issue